Yili - Gives the user permission to Reset and/or Change the password of any user #2860
Yili - Gives the user permission to Reset and/or Change the password of any user #2860one-community merged 5 commits intodevelopmentfrom
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
manikittu810
left a comment
There was a problem hiding this comment.
Hello @suaniii
Everything is working as mentioned.
Thank you.


anji-annavarapu
left a comment
There was a problem hiding this comment.
v1.mov
its working all expected.
Peter-Nie2003
left a comment
There was a problem hiding this comment.
The function work as expected, Well done!
Screen.Recording.2025-02-08.at.9.24.19.AM.mov
AurHubertMax
left a comment
There was a problem hiding this comment.
The permission to reset/change password of a user functions as expected. Gave permission to my volunteer 1 account to change password of any user, verified to see that the button to reset the password of my volunteer 2 account is available. Changed the account's password to a new password, and verified that the changes were in effect by logging into my volunteer 2 account with the new password.
z.PR.2860.proof.1.mp4
|
Reviewed PR. The code looks really good and shows a lot of effort in organizing everything. It takes care of managing user profiles, teams, permissions, and other tasks well. The tabs and modals are really cool features. |
karnati007
left a comment
There was a problem hiding this comment.
Tested the Reset / Change Password (Others) permission in Other Links → Permissions Management → Manage User Permissions as an owner user. Added the permission to a volunteer user, saved changes, and confirmed that the user could see the reset password button and successfully reset another volunteer user's password. Also tested by resetting my own account. Cleared site data and cache before testing. Everything is working as expected.


nathanah
left a comment
There was a problem hiding this comment.
Should consolidate update and reset password permissions.
| const response = await axios.get(ENDPOINTS.USER_PROFILE(userId)); | ||
| const currentUserEmail = response.data.email; | ||
| dispatch(setCurrentUser({ ...props.auth.user, email: currentUserEmail })); | ||
| setCanResetPassword(response.data.permissions.frontPermissions.includes('resetPassword')); |
There was a problem hiding this comment.
| setCanResetPassword(response.data.permissions.frontPermissions.includes('resetPassword')); | |
| const canResetPassword = props.hasPermission('resetPassword'); |
hasPermission() checks both role and individual permissions. The current way only checks individual permissions. Doesn't need to be a state obj because it won't change after being set.
There was a problem hiding this comment.
Changed to use updatePassword permission instead.
| </TabContent> | ||
| <div className="profileEditButtonContainer"> | ||
| {canUpdatePassword && canEdit && !isUserSelf && ( | ||
| {(canUpdatePassword && canEdit && !isUserSelf || canResetPassword) && ( |
There was a problem hiding this comment.
Doesn't updatePassword already do what resetPassword should do?
There was a problem hiding this comment.
Fixed, canUpdatePassword is now being used for this.
| }, | ||
| { | ||
| label: 'Reset / Change Password (Others)', | ||
| key: 'resetPassword', |
There was a problem hiding this comment.
I think the updatePassword permission was already mostly set up, but not included in PermissionsConst.js. Should be fixing/replacing updatePassword instead of adding a new permission of resetPassword on top of it.
There was a problem hiding this comment.
I've removed resetPassword from both BE and FE, and updatePassword is doing the job now.
5debe3d
319eed6 to
5debe3d
Compare
| const [showToggleVisibilityModal, setShowToggleVisibilityModal] = useState(false); | ||
| const [pendingRehireableStatus, setPendingRehireableStatus] = useState(null); | ||
| const [isRehireable, setIsRehireable] = useState(null); | ||
| const [canUpdatePassword, setCanUpdatePassword] = useState(props.hasPermission('updatePassword')); |
There was a problem hiding this comment.
| const [canUpdatePassword, setCanUpdatePassword] = useState(props.hasPermission('updatePassword')); |
There was a problem hiding this comment.
Removed this, use hasPermission() instead.
| const response = await axios.get(ENDPOINTS.USER_PROFILE(userId)); | ||
| const currentUserEmail = response.data.email; | ||
| dispatch(setCurrentUser({ ...props.auth.user, email: currentUserEmail })); | ||
| setCanUpdatePassword(response.data.permissions.frontPermissions.includes('updatePassword')); |
There was a problem hiding this comment.
| setCanUpdatePassword(response.data.permissions.frontPermissions.includes('updatePassword')); |
This doesn't check role permissions.
There was a problem hiding this comment.
Removed this, use hasPermission() instead.
| const canChangeUserStatus = props.hasPermission('changeUserStatus'); | ||
| const canAddDeleteEditOwners = props.hasPermission('addDeleteEditOwners'); | ||
| const canPutUserProfile = props.hasPermission('putUserProfile'); | ||
| const canUpdatePassword = props.hasPermission('updatePassword'); |
There was a problem hiding this comment.
This is how it should be done. canUpdatePassword doesn't need to be a state object and should always be set to props.hasPermission('updatePassword').
There was a problem hiding this comment.
Reverted my changes, now it's using hasPermission()
c14fba2 to
593597a
Compare
|
Thank you all, merging! |






Description
Related PRS
This frontend PR is related to the backend PR #1146
How to test:
npm installand...to run this PR locallyScreenshots or videos of changes:
0.mov