From a1976e4f0b5db8bd97e9c7d29dd7d8b9b4fa4c3d Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Tue, 22 Mar 2022 11:05:13 +0800 Subject: [PATCH] fix: api docs --- apps/assets/api/asset.py | 2 +- apps/rbac/backends.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/assets/api/asset.py b/apps/assets/api/asset.py index 7be40c72b..3f4b7a209 100644 --- a/apps/assets/api/asset.py +++ b/apps/assets/api/asset.py @@ -181,7 +181,7 @@ class AssetsTaskCreateApi(AssetsTaskMixin, generics.CreateAPIView): def check_permissions(self, request): action = request.data.get('action') action_perm_require = { - 'refresh': 'assets.refresh_assethardwareinfo1', + 'refresh': 'assets.refresh_assethardwareinfo', } perm_required = action_perm_require.get(action) has = self.request.user.has_perm(perm_required) diff --git a/apps/rbac/backends.py b/apps/rbac/backends.py index bc9dbb56a..76ebd1d70 100644 --- a/apps/rbac/backends.py +++ b/apps/rbac/backends.py @@ -16,7 +16,7 @@ class RBACBackend(JMSBaseAuthBackend): return False def has_perm(self, user_obj, perm, obj=None): - if not user_obj.is_active: + if not user_obj.is_active or not perm: raise PermissionDenied() if perm == '*': return True