refactor: streamline auth_resource method for improved readability and maintainability

v3.2
CaptainB 2025-07-05 18:06:00 +08:00
parent e7a30903ba
commit 13596ed7e8
1 changed files with 21 additions and 23 deletions

View File

@ -104,8 +104,6 @@ class UserResourcePermissionSerializer(serializers.Serializer):
def auth_resource(self, resource_id: str): def auth_resource(self, resource_id: str):
self.is_valid(raise_exception=True) self.is_valid(raise_exception=True)
workspace_manage = is_workspace_manage(self.data.get('user_id'), self.data.get('workspace_id'))
if not workspace_manage:
auth_target_type = self.data.get('auth_target_type') auth_target_type = self.data.get('auth_target_type')
workspace_id = self.data.get('workspace_id') workspace_id = self.data.get('workspace_id')
user_id = self.data.get('user_id') user_id = self.data.get('user_id')