Merge pull request #3564 from jumpserver/dev_bai

[Update] 修改校验用户资产权限API不使用缓存
pull/3572/head
BaiJiangJie 2019-12-25 10:30:45 +08:00 committed by GitHub
commit deeb9cdfa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,9 @@ class GetUserAssetPermissionActionsApi(UserAssetPermissionMixin,
class ValidateUserAssetPermissionApi(UserAssetPermissionMixin, APIView):
permission_classes = (IsOrgAdminOrAppUser,)
def get_cache_policy(self):
return 0
def get_obj(self):
user_id = self.request.query_params.get('user_id', '')
user = get_object_or_404(User, id=user_id)

View File

@ -10,9 +10,12 @@ from ...hands import Node, Asset
class UserAssetPermissionMixin(UserPermissionMixin):
util = None
def get_cache_policy(self):
return self.request.query_params.get('cache_policy', '0')
@lazyproperty
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")
util = AssetPermissionUtilV2(self.obj, cache_policy=cache_policy)
if system_user_id: