Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions apps/common/constants/permission_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ class Operate(Enum):
USE = "USE"
IMPORT = "READ+IMPORT"
EXPORT = "READ+EXPORT" # 导入导出
DEBUG = "READ+DEBUG" # 调试
SYNC = "READ+SYNC" # 同步
GENERATE = "READ+GENERATE" # 生成
ADD_MEMBER = "READ+ADD_MEMBER" # 添加成员
Expand Down Expand Up @@ -314,7 +313,6 @@ def get_workspace_role(self):
Group.KNOWLEDGE_HIT_TEST.value: _("Hit-Test"),
Operate.IMPORT.value: _("Import"),
Operate.EXPORT.value: _("Export"),
Operate.DEBUG.value: _("Debug"),
Operate.SYNC.value: _("Sync"),
Operate.GENERATE.value: _("Generate"),
Operate.ADD_MEMBER.value: _("Add Member"),
Expand Down Expand Up @@ -1092,10 +1090,6 @@ class PermissionConstants(Enum):
group=Group.SYSTEM_TOOL, operate=Operate.EXPORT, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.SHARED_TOOL], is_ee=settings.edition == "EE"
)
SHARED_TOOL_DEBUG = Permission(
group=Group.SYSTEM_TOOL, operate=Operate.DEBUG, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.SHARED_TOOL], is_ee=settings.edition == "EE"
)
SHARED_KNOWLEDGE_READ = Permission(
group=Group.SYSTEM_KNOWLEDGE, operate=Operate.READ, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.SHARED_KNOWLEDGE], is_ee=settings.edition == "EE"
Expand Down Expand Up @@ -1229,10 +1223,6 @@ class PermissionConstants(Enum):
group=Group.SYSTEM_RES_APPLICATION, operate=Operate.DELETE, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.RESOURCE_APPLICATION], is_ee=settings.edition == "EE"
)
RESOURCE_APPLICATION_DEBUG = Permission(
group=Group.SYSTEM_RES_APPLICATION, operate=Operate.DEBUG, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.RESOURCE_APPLICATION], is_ee=settings.edition == "EE"
)
RESOURCE_APPLICATION_EXPORT = Permission(
group=Group.SYSTEM_RES_APPLICATION, operate=Operate.EXPORT, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.RESOURCE_APPLICATION], is_ee=settings.edition == "EE"
Expand Down Expand Up @@ -1420,10 +1410,6 @@ class PermissionConstants(Enum):
group=Group.SYSTEM_RES_TOOL, operate=Operate.DELETE, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.RESOURCE_TOOL], is_ee=settings.edition == "EE"
)
RESOURCE_TOOL_DEBUG = Permission(
group=Group.SYSTEM_RES_TOOL, operate=Operate.DEBUG, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.RESOURCE_TOOL], is_ee=settings.edition == "EE"
)
RESOURCE_TOOL_EXPORT = Permission(
group=Group.SYSTEM_RES_TOOL, operate=Operate.EXPORT, role_list=[RoleConstants.ADMIN],
parent_group=[SystemGroup.RESOURCE_TOOL], is_ee=settings.edition == "EE"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code appears to be an enumeration of operation types and related permissions for different groups. However, there's one issue with the DEBUG operations being defined twice:

  • In line 144, it defines DEBUG as both a string literal "DEBUG" and as part of an enumeration value Operate.DEBUG.
  • In line 314, it also defines DEBUG again within the function get_workspace_role.

To resolve this duplication, you should remove the first instance of defining DEBUG as a string in the Enum. Here’s what the corrected section might look like:

@@ -144,7 +144,6 @@ class Operate(Enum):
     USE = "USE"
     IMPORT = "READ+IMPORT"
     EXPORT = "READ+EXPORT"  # 导入导出
     SYNCHRONIZE = "READ+SYNC"  # 同步
     GENERATE = "READ+GENERATE"  # 生成
     ADD_MEMBER = "READ+ADD_MEMBER"  # 添加成员
@@ -314,7 +313,6 @@ def get_workspace_role(self):
     GROUP.KNOWLEDGE_HIT_TEST.value: _("Hit-Test"),
     OPERATE.IMPORT.value: _("Import"),
     OPERATE.EXPORT.value: _("Export"),
     OPERATE.SYNCHRONIZE.value: _("Sync"),
     OPERATE.GENERATE.value: _("Generate"),
     OPERATE.ADD_MEMBER.value: _("Add Member"),

This will ensure that DEBUG is only defined once and used appropriately across the entire file.

Expand Down
Loading