[WEB-2277] fix: project intake viewer permission validation#5408
[WEB-2277] fix: project intake viewer permission validation#5408
Conversation
WalkthroughThe changes introduce user role management into the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ProjectInboxHeader
participant InboxIssueCreateEditModalRoot
User->>ProjectInboxHeader: Check user role
ProjectInboxHeader-->>User: Determine if viewer
alt User is not a viewer
ProjectInboxHeader->>InboxIssueCreateEditModalRoot: Render modal
else User is a viewer
ProjectInboxHeader-->>User: Do not render modal
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/inbox/header.tsx (2 hunks)
Additional comments not posted (3)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/inbox/header.tsx (3)
15-15: Import statement foruseUseris correctly added.The addition of the
useUserhook is necessary for implementing user role checks.
23-30: User role logic is correctly implemented.The extraction of
currentProjectRoleand the derivation ofisViewerare correctly implemented to determine user permissions.
69-69: Conditional rendering logic is correctly implemented.The component is correctly rendered only if the user is not a viewer, enhancing access control.
| </div> | ||
|
|
||
| {currentProjectDetails?.inbox_view && workspaceSlug && projectId && ( | ||
| {currentProjectDetails?.inbox_view && workspaceSlug && projectId && !isViewer && ( |
There was a problem hiding this comment.
Show it to any role that is greater than or equal to guest.
Changes:
This PR fixes the intake issue permission validation. Previously, users with viewer permissions could access the create issue modal, which was not the intended behavior.
Reference:
[WEB-2277]
Media: