Sai Teja - Fix pause/resume permission flow in profile and user management#5122
Sai Teja - Fix pause/resume permission flow in profile and user management#5122saitejakaasoju wants to merge 6 commits intodevelopmentfrom
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| const rolesAllowedToEditStatusFinalDay = ['Administrator', 'Owner']; | ||
| const canEditStatus = | ||
| rolesAllowedToEditStatusFinalDay.includes(role) || dispatch(hasPermission('pauseUserActivity')); | ||
| const canEditStatus = props.hasPermission?.('interactWithPauseUserButton'); |
There was a problem hiding this comment.
| const canEditStatus = props.hasPermission?.('interactWithPauseUserButton'); | |
| const canEditStatus = dispatch(hasPermission('interactWithPauseUserButton'); |
Can use the original way of calling hasPermission() with dispatch().
There was a problem hiding this comment.
Addressed Nathan’s feedback by removing the hasPermission prop drilling from UserProfile/BasicInformationTab and switching the permission check back to the dispatch-based hasPermission('interactWithPauseUserButton') pattern inside BasicInformationTab. I also repaired the failing UserTableData test file and reran the related pause/user-management test slice locally. This is ready for re-review.
nathanah
left a comment
There was a problem hiding this comment.
Double-check that requestor is needed, and fix the slight redundancy. Everything else looks good. Good job
| const rolesAllowedToEditStatusFinalDay = ['Administrator', 'Owner']; | ||
| const canEditStatus = | ||
| rolesAllowedToEditStatusFinalDay.includes(role) || dispatch(hasPermission('pauseUserActivity')); | ||
| rolesAllowedToEditStatusFinalDay.includes(role) || |
There was a problem hiding this comment.
| rolesAllowedToEditStatusFinalDay.includes(role) || |
Redundant since hasPermission() also checks role permissions.
There was a problem hiding this comment.
I double-checked the current backend implementation before changing this. requestor is still required in the request body for the user status / pause-resume authorization path, so I kept it to avoid breaking the working flow and addressed this by removing the redundant explicit role check and relying on the existing hasPermission('interactWithPauseUserButton') path.
|



Description
Implements the frontend side of the dedicated pause/resume permission flow and fixes pause/resume behavior across the profile page and User Management table.
This PR updates the app to use the new
interactWithPauseUserButtonpermission consistently, routes pause/resume actions through the dedicated pause endpoint, and removes stale permission/bypass logic that caused visibility and behavior mismatches.Fixes priority high bug(s):
pauseUserActivitystill affected frontend behaviorRelated PRs (if any):
This frontend PR is related to the backend PR:
sai/pause-user-permission-backendTo fully test this frontend PR, you need to run the matching backend PR as well.
Main changes explained:
src/actions/userManagement.jsto:requestorin pause/resume requestssrc/utils/URL.jsto include the dedicatedUSER_PAUSEendpointsrc/components/UserManagement/PauseAndResumeButton.jsxto use the new pause/resume action pathsrc/components/UserManagement/UserManagement.jsxso table resume/reactivate flows use the dedicated pause endpoint instead of the old lifecycle actionsrc/components/UserManagement/UserTableData.jsxto keep pause/resume table behavior aligned and clean up syntax issuessrc/components/UserProfile/BasicInformationTab/BasicInformationTab.jsxto remove the hardcoded Owner/Admin visibility bypass and rely on the real permissionsrc/components/UserProfile/UserProfile.jsxto passhasPermissionintoBasicInformationTabsrc/components/PermissionsManagement/Permissions.jsonto remove the oldpauseUserActivityentrysrc/utils/routePermissions.jsandsrc/components/Header/Header.jsxto recognizeinteractWithPauseUserButtonHow to test:
HighestGoodNetworkAppHGNRestinteractWithPauseUserButtonPausebutton is visible when the permission is presentPausesuccessfully pauses the userResumesuccessfully reactivates the userinteractWithPauseUserButtonfrom an Owner/Admin account and verify:Pausebutton no longer appears on the profile pageinteractWithPauseUserButtonto a non-admin user and verify they can use pause/resume appropriatelypauseUserActivitypermission is no longer shown/usedScreenshots or videos of changes:
Screen.Recording.2026-04-08.at.9.32.54.PM.mov
Note:
This PR should be tested together with the matching backend PR because the dedicated pause route and permission checks are implemented there.