Skip to content

Commit

Permalink
minor: 项目 API 依赖项目查看权限 --story=119850966
Browse files Browse the repository at this point in the history
  • Loading branch information
benero committed Oct 8, 2024
1 parent c5e041c commit 095ea83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion itsm/postman/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion itsm/postman/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 095ea83

Please sign in to comment.