Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff is a small permission-decorator change:
Assessment
RoleConstantsandhas_permissions(...).has_permissionsexpects a workspace-scoped role or a global/base role.Potential issues
Inconsistent role normalization
.get_workspace_role(), butRoleConstants.ADMINand nowRoleConstants.EXTENDS_ADMINdo not.EXTENDS_ADMINhas aget_workspace_role()method, this change may accidentally pass the wrong role representation and cause:EXTENDS_ADMINis already a workspace-level/global role and has no such method, the change is likely correct.Possible security impact
RoleConstants.EXTENDS_ADMINvalue matches the value stored/expected byhas_permissions.Consistency with
ADMINRoleConstants.ADMINis already passed raw. If that is intentional because admins are global, thenEXTENDS_ADMINbeing raw may also be intentional.Recommendations
has_permissions: does it accept global roles, workspace roles, or both?RoleConstants.EXTENDS_ADMINhasget_workspace_role():ADMINandEXTENDS_ADMINare passed differently, if intentional.Suggested refactor
Centralize the allowed roles to avoid forgetting or misusing
.get_workspace_role():Then:
@has_permissions(*WORKSPACE_USER_MEMBER_ROLES)This improves readability, consistency, and testability.
Tests to add
Add permission-matrix tests covering:
ADMINEXTENDS_ADMINWORKSPACE_MANAGEEXTENDS_WORKSPACE_MANAGEUSEREXTENDS_USERVerify that each role gets the expected allow/deny result, especially around
EXTENDS_ADMIN.Verdict: The change may be correct if
EXTENDS_ADMINis already the value expected byhas_permissions. Otherwise, it introduces a permission-matching bug. Verify theRoleConstantsdefinition and add a regression test forEXTENDS_ADMIN.