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()