From 2f839877d1be8257aca836b99d42f87f1d9461d6 Mon Sep 17 00:00:00 2001 From: vapao Date: Sun, 14 Jun 2020 20:39:36 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=9B=E5=BB=BA=E5=BA=94=E7=94=A8=E6=88=96?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=9F=90=E4=BA=9B=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spug_api/apps/account/models.py b/spug_api/apps/account/models.py index 8ec1c88..bd2499f 100644 --- a/spug_api/apps/account/models.py +++ b/spug_api/apps/account/models.py @@ -91,7 +91,9 @@ class Role(models.Model, ModelMixin): return tmp def add_deploy_perm(self, target, value): - perms = json.loads(self.deploy_perms) if self.deploy_perms else {'apps': [], 'envs': []} + perms = {'apps': [], 'envs': []} + if self.deploy_perms: + perms.update(json.loads(self.deploy_perms)) perms[target].append(value) self.deploy_perms = json.dumps(perms) self.save()