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