Skip to content

Commit

Permalink
fix(backend): 修复1.3权限获取资源错误的问题 #3611
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Mar 20, 2024
1 parent 18da64b commit db0fda9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dbm-ui/backend/iam_app/dataclass/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class ActionEnum:
def get_action_by_id(cls, action_id: Union[(ActionMeta, str)]) -> ActionMeta:
if isinstance(action_id, ActionMeta):
return action_id
if action_id not in cls.__dict__:
if action_id.lower() not in _all_actions:
raise ActionNotExistError(_("动作ID不存在: {}").format(action_id))
return cls.__dict__[action_id]
return _all_actions[action_id.lower()]


_all_actions = {action.id: action for action in ActionEnum.__dict__.values() if isinstance(action, ActionMeta)}
4 changes: 2 additions & 2 deletions dbm-ui/backend/iam_app/dataclass/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def get_resource_by_id(cls, resource_id: Union[ResourceMeta, str]):
if isinstance(resource_id, ResourceMeta):
return resource_id

if resource_id not in cls.__dict__:
if resource_id not in _all_resources:
raise ResourceNotExistError(_("资源类型ID不存在: {}").format(resource_id))

return cls.__dict__[resource_id]
return _all_resources[resource_id]


_all_resources = {resource.id: resource for resource in ResourceEnum.__dict__.values() if hasattr(resource, "id")}

0 comments on commit db0fda9

Please sign in to comment.