From 4382921c574779d05fabd88e9f85304c9dc4fb26 Mon Sep 17 00:00:00 2001 From: "fghbng@qq.com" Date: Fri, 14 May 2021 18:07:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=88=E6=9D=83=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E4=BC=98=E5=8C=96=E8=B5=84=E4=BA=A7=E3=80=81=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E3=80=81=E7=94=A8=E6=88=B7=E7=BB=84=E3=80=81=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E3=80=81=E7=B3=BB=E7=BB=9F=E7=94=A8=E6=88=B7id?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=8A=A5=E9=94=99=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/perms/serializers/asset/permission.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/perms/serializers/asset/permission.py b/apps/perms/serializers/asset/permission.py index dcaffb82f..1ee95afee 100644 --- a/apps/perms/serializers/asset/permission.py +++ b/apps/perms/serializers/asset/permission.py @@ -83,6 +83,16 @@ class AssetPermissionSerializer(BulkOrgResourceModelSerializer): return queryset def to_internal_value(self, data): + if not data['assets']: + data['assets'] = [] + if not data['system_users']: + data['system_users'] = [] + if not data['users']: + data['users'] = [] + if not data['user_groups']: + data['user_groups'] = [] + if not data['nodes']: + data['nodes'] = [] # 系统用户是必填项 system_users_display = data.pop('system_users_display', '') for i in range(len(system_users_display)):