From 095ea832406ce078fcc306b4c57b9bfcde6b07c2 Mon Sep 17 00:00:00 2001 From: benero Date: Tue, 8 Oct 2024 17:25:58 +0800 Subject: [PATCH] =?UTF-8?q?minor:=20=E9=A1=B9=E7=9B=AE=20API=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E9=A1=B9=E7=9B=AE=E6=9F=A5=E7=9C=8B=E6=9D=83=E9=99=90?= =?UTF-8?q?=20--story=3D119850966?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- itsm/postman/permissions.py | 5 ++++- itsm/postman/views.py | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/itsm/postman/permissions.py b/itsm/postman/permissions.py index 1830ff99..741ccfdb 100644 --- a/itsm/postman/permissions.py +++ b/itsm/postman/permissions.py @@ -88,5 +88,8 @@ def has_object_permission(self, request, view, obj, **kwargs): # 项目管理 project_key = obj.remote_system.project_key project = Project.objects.get(pk=project_key) - return self.iam_auth(request, ["system_settings_manage"], project) + apply_actions = ["system_settings_manage"] + if view.action == "retrieve": + apply_actions = ["project_view"] + return self.iam_auth(request, apply_actions, project) return True diff --git a/itsm/postman/views.py b/itsm/postman/views.py index 5e62c610..3bbd2b19 100644 --- a/itsm/postman/views.py +++ b/itsm/postman/views.py @@ -191,7 +191,6 @@ class RemoteApiViewSet(DynamicListModelMixin, ModelViewSet): permission_classes = (RemoteApiPermit,) permission_resource_is_project = True permission_create_action = ["create", "imports"] - permission_free_actions = ["retrieve"] filter_fields = { "is_activated": ["exact"],