F 修复普通用户创建应用或环境某些情况下失败的问题

pull/137/head
vapao 2020-06-14 20:39:36 +08:00
parent 1a89fae8c1
commit 2f839877d1
1 changed files with 3 additions and 1 deletions

View File

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