fix(permissions): Allow non-orgadmin users to access Notifications Log#911
fix(permissions): Allow non-orgadmin users to access Notifications Log#911InsaneZein wants to merge 2 commits intomasterfrom
Conversation
RHCLOUD-29703 The Notifications Log page was incorrectly gated behind the canReadNotifications permission (notifications:notifications:read), which controls access to notification configuration/settings. Since the Notifications Log page displays the same data as the notification drawer (which is accessible to all authenticated users), it should not require this permission. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughShort-circuits notification read permission in CheckReadPermissions for the notifications log path, and adds tests covering notifications, events, and notifications-log routes under various RBAC states. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Chromatic Build
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/__tests__/CheckReadPermissions.test.tsx (1)
53-68: Optionally harden negative-path assertions.On Line 67 and Line 118, asserting only that child content is missing can pass even if nothing renders. Consider also asserting
NotAuthorizedPagecontent is present to prevent false positives.Also applies to: 104-119
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/__tests__/CheckReadPermissions.test.tsx` around lines 53 - 68, The test for CheckReadPermissions currently only asserts that the childText is not in the document, which can give false positives; update the negative-path tests (the one using getConfiguredAppWrapper with router initialEntries '/rhel' and rbac canReadNotifications:false, and the similar case at lines 104-119) to also assert that the NotAuthorizedPage is rendered by checking for its visible content/text (e.g., the NotAuthorizedPage heading or message) after rendering the component; locate tests referencing CheckReadPermissions, childText, mockGetApp, and Wrapper/getConfiguredAppWrapper and add an expectation that the NotAuthorizedPage text is present in addition to the existing not.toBeInTheDocument assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/__tests__/CheckReadPermissions.test.tsx`:
- Around line 53-68: The test for CheckReadPermissions currently only asserts
that the childText is not in the document, which can give false positives;
update the negative-path tests (the one using getConfiguredAppWrapper with
router initialEntries '/rhel' and rbac canReadNotifications:false, and the
similar case at lines 104-119) to also assert that the NotAuthorizedPage is
rendered by checking for its visible content/text (e.g., the NotAuthorizedPage
heading or message) after rendering the component; locate tests referencing
CheckReadPermissions, childText, mockGetApp, and Wrapper/getConfiguredAppWrapper
and add an expectation that the NotAuthorizedPage text is present in addition to
the existing not.toBeInTheDocument assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c1ce361b-e0ad-4f5c-bfb3-fa20b5d82e52
📒 Files selected for processing (2)
src/components/CheckReadPermissions.tsxsrc/components/__tests__/CheckReadPermissions.test.tsx
…sions RHCLOUD-29703 Assert NotAuthorizedPage renders (via User Preferences link) in unauthorized test cases, preventing false positives when nothing renders.
|
Addressed the nitpick — commit 7bd431c adds |
Summary
CheckReadPermissionsgated/notificationslogbehindcanReadNotifications(notifications:notifications:read), which controls access to notification configuration/settings — not viewing one's own notificationsCheckReadPermissionscovering all permission pathsTest plan
/notificationslogwithoutnotifications:notifications:readpermission/notificationslog/eventlogstill requirescanReadEventspermissioncanReadNotificationspermission🤖 Generated with Claude Code