Unverified Commit deeb9cdf authored by BaiJiangJie's avatar BaiJiangJie Committed by GitHub

Merge pull request #3564 from jumpserver/dev_bai

[Update] 修改校验用户资产权限API不使用缓存
parents 15d1e021 7a6a1b9b
...@@ -59,6 +59,9 @@ class GetUserAssetPermissionActionsApi(UserAssetPermissionMixin, ...@@ -59,6 +59,9 @@ class GetUserAssetPermissionActionsApi(UserAssetPermissionMixin,
class ValidateUserAssetPermissionApi(UserAssetPermissionMixin, APIView): class ValidateUserAssetPermissionApi(UserAssetPermissionMixin, APIView):
permission_classes = (IsOrgAdminOrAppUser,) permission_classes = (IsOrgAdminOrAppUser,)
def get_cache_policy(self):
return 0
def get_obj(self): def get_obj(self):
user_id = self.request.query_params.get('user_id', '') user_id = self.request.query_params.get('user_id', '')
user = get_object_or_404(User, id=user_id) user = get_object_or_404(User, id=user_id)
......
...@@ -10,9 +10,12 @@ from ...hands import Node, Asset ...@@ -10,9 +10,12 @@ from ...hands import Node, Asset
class UserAssetPermissionMixin(UserPermissionMixin): class UserAssetPermissionMixin(UserPermissionMixin):
util = None util = None
def get_cache_policy(self):
return self.request.query_params.get('cache_policy', '0')
@lazyproperty @lazyproperty
def util(self): def util(self):
cache_policy = self.request.query_params.get('cache_policy', '0') cache_policy = self.get_cache_policy()
system_user_id = self.request.query_params.get("system_user") system_user_id = self.request.query_params.get("system_user")
util = AssetPermissionUtilV2(self.obj, cache_policy=cache_policy) util = AssetPermissionUtilV2(self.obj, cache_policy=cache_policy)
if system_user_id: if system_user_id:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment