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
4 changes: 2 additions & 2 deletions apps/knowledge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def get(self, request: Request, workspace_id: str, knowledge_id: str):
tags=[_('Knowledge Base/Documentation/Paragraph/Question')] # type: ignore
)
@has_permissions(
PermissionConstants.KNOWLEDGE_PROBLEM_EDIT.get_workspace_knowledge_permission(),
PermissionConstants.KNOWLEDGE_PROBLEM_EDIT.get_workspace_permission_workspace_manage_role(),
PermissionConstants.KNOWLEDGE_PROBLEM_CREATE.get_workspace_knowledge_permission(),
PermissionConstants.KNOWLEDGE_PROBLEM_CREATE.get_workspace_permission_workspace_manage_role(),
RoleConstants.WORKSPACE_MANAGE.get_workspace_role(),
ViewPermission([RoleConstants.USER.get_workspace_role()],
[PermissionConstants.KNOWLEDGE.get_workspace_knowledge_permission()], CompareConstants.AND),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code provided has minor syntax issues that can be addressed:

  1. In the ViewPermission function, there is an error with the comparison operator. It should use CompareConstants.OR instead of CompareConstants.AND. Ensure proper case sensitivity when using constants like CompareConstants.

Here's the corrected line:

        ViewPermission([RoleConstants.USER.get_workspace_role()],
                     [PermissionConstants.KNOWLEDGE.get_workspace_knowledge_permission()], CompareConstants.OR),

Additionally, consider simplifying the logic for user permissions and roles to avoid unnecessary conditions. This might require rethinking how permission validation works within the system.

Overall, these changes will help ensure that the code runs without syntax errors and potentially improves its readability and maintainability.

Expand Down
Loading