From e6a1abb4071caff198c9c5221767a4c5b428cb97 Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 27 Jul 2022 15:21:48 +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=E7=9A=84=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9C=AA=E5=B1=95=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/models.py | 1 + spug_api/apps/app/views.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spug_api/apps/account/models.py b/spug_api/apps/account/models.py index 6031104..80cafff 100644 --- a/spug_api/apps/account/models.py +++ b/spug_api/apps/account/models.py @@ -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 diff --git a/spug_api/apps/app/views.py b/spug_api/apps/app/views.py index 0571704..67c0336 100644 --- a/spug_api/apps/app/views.py +++ b/spug_api/apps/app/views.py @@ -2,7 +2,7 @@ # Copyright: (c) # 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')