F 修复普通用户创建的发布配置未展示的问题

pull/586/head
vapao 2022-07-27 15:21:48 +08:00
parent a4beb4d2ed
commit e6a1abb407
2 changed files with 3 additions and 2 deletions

View File

@ -62,6 +62,7 @@ class User(models.Model, ModelMixin):
perms = json.loads(item.deploy_perms)
data['apps'].update(perms.get('apps', []))
data['envs'].update(perms.get('envs', []))
data['apps'].update(x.id for x in self.app_set.all())
return data
@property

View File

@ -2,7 +2,7 @@
# Copyright: (c) <spug.dev@gmail.com>
# Released under the AGPL-3.0 License.
from django.views.generic import View
from django.db.models import F, Q
from django.db.models import F
from libs import JsonParser, Argument, json_response, auth
from apps.app.models import App, Deploy, DeployExtend1, DeployExtend2
from apps.config.models import Config, ConfigHistory
@ -18,7 +18,7 @@ class AppView(View):
apps = App.objects.all()
else:
ids = request.user.deploy_perms['apps']
apps = App.objects.filter(Q(id__in=ids) | Q(created_by=request.user))
apps = App.objects.filter(id__in=ids)
return json_response(apps)
@auth('deploy.app.add|deploy.app.edit|config.app.add|config.app.edit')