fix: Application menu displays conversation users and conversation logs#3932
Conversation
--bug=1060818 --user=张展玮 【应用】应用只授权用户查看权限,详情页,没有展示对话用户、对话日志菜单 https://www.tapd.cn/62980211/s/1760973
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| resource_permission_group_list=[ResourcePermissionConst.APPLICATION_VIEW], | ||
| ) | ||
|
|
||
| APPLICATION_CHAT_LOG_ANNOTATION = Permission(group=Group.APPLICATION_CHAT_LOG, operate=Operate.ANNOTATION, |
There was a problem hiding this comment.
The current code snippet is mostly correct, but here are a few potential improvements:
-
Consistency in Resource Permissions: The
resource_permission_group_listfor bothapplication_chat_log_readandapplication_chat_log_annotationcontain[ResourcePermissionConst.APPLICATION_MANGE], which might not be suitable based on how permissions work internally within your application. -
Documentation of Group/Operate/Roles: Adding comments to describe the group (e.g., what type of chat log it affects), operate (e.g., read, edit, etc.), and roles should help clarify their purpose.
Here's an updated version with some minor adjustments:
class PermissionConstants(Enum):
# Define permissions related to application chat users
APPLICATION_CHAT_USER_READ = Permission(
group=Group.APPLICATION_CHAT_USER,
operate=Operate.READ,
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
parent_group=[WorkspaceGroup.APPLICATION, UserGroup.APPLICATION],
resource_permission_group_list=[ResourcePermissionConst.APPLICATION_VIEW], # Adjusted to view instead of manage
)
APPLICATION_CHAT_USER_EDIT = Permission(
group=Group.APPLICATION_CHAT_USER,
operate=Operate.EDIT,
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
parent_group=[WorkspaceGroup.APPLICATION, UserGroup.APPLICATION],
resource_permission_group_list=[ResourcePermissionConst.APPLICATION_UPDATE], # Updated to update if necessary
)
# Define permissions related to application chat logs
APPLICATION_CHAT_LOG_READ = Permission(
group=Group.APPLICATION_CHAT_LOG,
operate=Operate.READ,
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
parent_group=[WorkspaceGroup.APPLICATION, UserGroup.APPLICATION],
resource_permission_group_list=[ResourcePermissionConst.APPLICATION_VIEW], # Adjusted to view instead of manage
)
APPLICATION_CHAT_LOG_ANNOTATION = Permission(
group=Group.APPLICATION_CHAT_LOG,
operate=Operate.ANNOTATE,
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
parent_group=[WorkspaceGroup.APPLICATION, UserGroup.APPLICATION],
resource_permission_group_list=[ResourcePermissionConst.APPLICATION_COMMENT], # Adjusted to comment if necessary
)Make sure to adjust the resource_permission_group_list according to your actual business logic and permission structure.
fix: Application menu displays conversation users and conversation logs --bug=1060818 --user=张展玮 【应用】应用只授权用户查看权限,详情页,没有展示对话用户、对话日志菜单 https://www.tapd.cn/62980211/s/1760973