From 29457ad867b4001cd54459e24d74614256dc7afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AB=E5=8D=83=E6=B5=81?= <40739051+jym503558564@users.noreply.github.com> Date: Tue, 14 Jan 2020 16:44:28 +0800 Subject: [PATCH] =?UTF-8?q?Assets=5Fpermission=5Faction=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20(#3585)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Update] 初步实现 actions的checkbox层叠嵌套 * [Update] 优化actions的checkbox层叠嵌套 * [Update] 修改校验用户/系统用户/资产的权限API可能会出现的问题 * [Update] 更新资产授权中动作的展示 * [Update] 更新资产授权中动作的展示 2 * [Update] 更新资产授权中动作的展示 3 Co-authored-by: BaiJiangJie <32935519+BaiJiangJie@users.noreply.github.com> --- apps/perms/api/user_permission/common.py | 2 + .../perms/asset_permission_create_update.html | 86 ++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/apps/perms/api/user_permission/common.py b/apps/perms/api/user_permission/common.py index 003e38856..12469d3da 100644 --- a/apps/perms/api/user_permission/common.py +++ b/apps/perms/api/user_permission/common.py @@ -84,6 +84,8 @@ class ValidateUserAssetPermissionApi(UserAssetPermissionMixin, APIView): system_users_actions = self.util.get_asset_system_users_with_actions( asset) actions = system_users_actions.get(system_user) + if actions is None: + return Response({'msg': False}, status=403) if action_name in Action.value_to_choices(actions): return Response({'msg': True}, status=200) return Response({'msg': False}, status=403) diff --git a/apps/perms/templates/perms/asset_permission_create_update.html b/apps/perms/templates/perms/asset_permission_create_update.html index 4cb5928eb..937e7273e 100644 --- a/apps/perms/templates/perms/asset_permission_create_update.html +++ b/apps/perms/templates/perms/asset_permission_create_update.html @@ -4,6 +4,17 @@ {% load bootstrap3 %} {% block custom_head_css_js %} + {% endblock %} {% block content %} @@ -33,20 +44,55 @@ {% endif %} {% csrf_token %} +