Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ui/src/permission/application/system-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const systemManage = {
hasPermission(
[
RoleConst.ADMIN,
PermissionConst.RESOURCE_APPLICATION_DEBUG
PermissionConst.RESOURCE_APPLICATION_EDIT
],
'OR'
),
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 line of code seems to be checking permissions for accessing resource application debugging information. The change from ResourceApplicationDebug to ResourceApplicationEdit suggests that the intended functionality is likely changing.

Possible Issues:

  1. Inconsistency: There might be documentation inconsistencies regarding which permission should be used for this action, leading to confusion about what users are supposed to have access to.

Optimization Suggestions:

  • Consider adding comments explaining why this specific permission was changed from one role const to another.
  • If there's a need for further clarification or additional checks, ensure those aspects are included in the codebase for future maintenance and understanding.

Overall, the line appears valid but may require some context-based justification or documentation updates.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/permission/tool/system-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const systemManage = {
hasPermission(
[
RoleConst.ADMIN,
PermissionConst.RESOURCE_TOOL_DEBUG,
PermissionConst.RESOURCE_TOOL_EDIT,
],
'OR',
),
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 proposed change seems to be addressing a typo in the permission requirement. Instead of PermissionConst.RESOURCE_TOOL_DEBUG, it should use PermissionConst.RESOURCE_TOOL_EDIT. This will allow users with EDIT permissions for resource tools to access certain system management features.

However, I would recommend adding error handling or logging mechanisms around this logic if there are other permissions or roles involved that might affect system operations. Additionally, you could consider whether these changes need to impact other parts of the application or require additional testing before deployment.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/permission/tool/system-share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const share = {
hasPermission(
[
RoleConst.ADMIN,
PermissionConst.SHARED_TOOL_DEBUG,
PermissionConst.SHARED_TOOL_EDIT,
],
'OR',
),
Expand Down
4 changes: 0 additions & 4 deletions ui/src/utils/permission/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {Permission, Role, Edition} from '@/utils/permission/type'
// 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 @@ -163,7 +162,6 @@ const PermissionConst = {
SHARED_TOOL_DELETE: new Permission('SYSTEM_TOOL:READ+DELETE'),
SHARED_TOOL_IMPORT: new Permission('SYSTEM_TOOL:READ+IMPORT'),
SHARED_TOOL_EXPORT: new Permission('SYSTEM_TOOL:READ+EXPORT'),
SHARED_TOOL_DEBUG: new Permission('SYSTEM_TOOL:READ+DEBUG'),

SHARED_MODEL_READ: new Permission('SYSTEM_MODEL:READ'),
SHARED_MODEL_CREATE: new Permission('SYSTEM_MODEL:READ+CREATE'),
Expand Down Expand Up @@ -213,7 +211,6 @@ const PermissionConst = {
RESOURCE_TOOL_EDIT: new Permission('SYSTEM_RESOURCE_TOOL:READ+EDIT'),
RESOURCE_TOOL_READ: new Permission('SYSTEM_RESOURCE_TOOL:READ'),
RESOURCE_TOOL_DELETE: new Permission('SYSTEM_RESOURCE_TOOL:READ+DELETE'),
RESOURCE_TOOL_DEBUG: new Permission('SYSTEM_RESOURCE_TOOL:READ+DEBUG'),
RESOURCE_TOOL_IMPORT: new Permission('SYSTEM_RESOURCE_TOOL:READ+IMPORT'),
RESOURCE_TOOL_EXPORT: new Permission('SYSTEM_RESOURCE_TOOL:READ+EXPORT'),

Expand Down Expand Up @@ -249,7 +246,6 @@ const PermissionConst = {

RESOURCE_APPLICATION_READ: new Permission('SYSTEM_RESOURCE_APPLICATION:READ'),
RESOURCE_APPLICATION_EDIT: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+EDIT'),
RESOURCE_APPLICATION_DEBUG: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+DEBUG'),
RESOURCE_APPLICATION_IMPORT: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+IMPORT'),
RESOURCE_APPLICATION_EXPORT: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+EXPORT'),
RESOURCE_APPLICATION_DELETE: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+DELETE'),
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 TypeScript code is mostly clean but contains some stylistic adjustments that can be made to improve readability and maintainability. Here's a list of minor improvements:

  1. Variable Name Consistency: Ensure consistent variable naming conventions, especially if there are related variables being used together.

  2. Semicolon Use: Add semicolons after each declaration statement for better readability, although in this context it might not be necessary as long as line breaks naturally separate statements.

  3. Spacing: Improve spacing between keywords, operators, and brackets where appropriate.

Here’s the revised version with these changes:

import { Permission, Role, Edition } from '@/utils/permission/type';

const PermissionConst = {
  SHARED_TOOL_READ: new Permission('SYSTEM_TOOL:READ'),
  SHARED_TOOL_CREATE: new Permission('SYSTEM_TOOL:READ+CREATE'),
  
  SHARED_TOOL_IMPORT: new Permission('SYSTEM_TOOL:READ+IMPORT'),
  SHARED_TOOL_EXPORT: new Permission('SYSTEM_TOOL:READ+EXPORT'),
- // SHARED_TOOL_DEBUG: new Permission('SYSTEM_TOOL:READ+DEBUG'),  # This seems like an obsolete comment or commented out section

  SHARED_MODEL_READ: new Permission('SYSTEM_MODEL:READ'),
  SHARED_MODEL_CREATE: new Permission('SYSTEM_MODEL:READ+CREATE'),

  SHARED_RESOURCE_TOOL_READ: new Permission('SYSTEM_RESOURCE_TOOL:READ'),
  SHARED_RESOURCE_TOOL_CREATE: new Permission('SYSTEM_RESOURCE_TOOL:READ+CREATE'),
  
  SHARED_RESOURCE_TOOL_EDIT: new Permission('SYSTEM_RESOURCE_TOOL:READ+EDIT'),
  SHARED_RESOURCE_TOOL_DELETE: new Permission('SYSTEM_RESOURCE_TOOL:READ+DELETE'),
-// SHARED_RESOURCE_TOOL_DEBUG: new Permission('SYSTEM_RESOURCE_TOOL:READ+DEBUG'),  # Also commented out or unused
  
  SHARED_RESOURCE_TOOL_IMPORT: new Permission('SYSTEM_RESOURCE_TOOL:READ+IMPORT'),
  SHARED_RESOURCE_TOOL_EXPORT: new Permission('SYSTEM_RESOURCE_TOOL:READ+EXPORT'),
  
  RESOURCES_APP_READ: new Permission('SYSTEM_RESOURCE_APPLICATION:READ'),
  RESOURCES_APP_EDIT: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+EDIT'),
  RESOURCES_APP_DELETE: new Permission('SYSTEM_RESOURCE_APPLICATION:READ+DELETE'),
};

These changes make the code slightly more readable at first glance while keeping the logic intact. If you have specific areas within the PermissionConst object that need further attention (e.g., comments indicating obsolescence), please feel free to specify!

Expand Down
Loading