mirror of https://github.com/openspug/spug
F 修复普通用户创建的发布配置未展示的问题
parent
a4beb4d2ed
commit
e6a1abb407
|
@ -62,6 +62,7 @@ class User(models.Model, ModelMixin):
|
||||||
perms = json.loads(item.deploy_perms)
|
perms = json.loads(item.deploy_perms)
|
||||||
data['apps'].update(perms.get('apps', []))
|
data['apps'].update(perms.get('apps', []))
|
||||||
data['envs'].update(perms.get('envs', []))
|
data['envs'].update(perms.get('envs', []))
|
||||||
|
data['apps'].update(x.id for x in self.app_set.all())
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright: (c) <spug.dev@gmail.com>
|
# Copyright: (c) <spug.dev@gmail.com>
|
||||||
# Released under the AGPL-3.0 License.
|
# Released under the AGPL-3.0 License.
|
||||||
from django.views.generic import View
|
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 libs import JsonParser, Argument, json_response, auth
|
||||||
from apps.app.models import App, Deploy, DeployExtend1, DeployExtend2
|
from apps.app.models import App, Deploy, DeployExtend1, DeployExtend2
|
||||||
from apps.config.models import Config, ConfigHistory
|
from apps.config.models import Config, ConfigHistory
|
||||||
|
@ -18,7 +18,7 @@ class AppView(View):
|
||||||
apps = App.objects.all()
|
apps = App.objects.all()
|
||||||
else:
|
else:
|
||||||
ids = request.user.deploy_perms['apps']
|
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)
|
return json_response(apps)
|
||||||
|
|
||||||
@auth('deploy.app.add|deploy.app.edit|config.app.add|config.app.edit')
|
@auth('deploy.app.add|deploy.app.edit|config.app.add|config.app.edit')
|
||||||
|
|
Loading…
Reference in New Issue