From 57d33698046b3b047e9e06e4e27dd0cd05e1d6aa Mon Sep 17 00:00:00 2001 From: vapao Date: Tue, 14 Apr 2020 14:16:02 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E6=9C=AA=E5=88=86?= =?UTF-8?q?=E9=85=8D=E5=BA=94=E7=94=A8=E6=9D=83=E9=99=90=E6=97=B6=E6=9F=90?= =?UTF-8?q?=E4=BA=9B=E6=8E=A5=E5=8F=A3=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spug_api/apps/account/models.py b/spug_api/apps/account/models.py index 03ee641..c4abf11 100644 --- a/spug_api/apps/account/models.py +++ b/spug_api/apps/account/models.py @@ -46,7 +46,10 @@ class User(models.Model, ModelMixin): @property def deploy_perms(self): - return json.loads(self.role.deploy_perms) if self.role.deploy_perms else {'apps': [], 'envs': []} + perms = json.loads(self.role.deploy_perms) if self.role.deploy_perms else {} + perms.setdefault('apps', []) + perms.setdefault('envs', []) + return perms def has_perms(self, codes): # return self.is_supper or self.role in codes