Skip to content

Conversation

@humemah
Copy link
Contributor

@humemah humemah commented Aug 30, 2025

Description

image

Related PRS (if any):

This frontend PR is related to the #3245

Main changes explained:

Updated src/components/Header/Header.jsx - Added setFinalDay permission to user management access check
Updated src/components/UserManagement/UserTableData.jsx - Added SetFinalDayButton component with permission check
Updated src/components/UserProfile/BasicInformationTab/BasicInformationTab.jsx - Added button visibility based on permission

How to test:

Check out this branch: git checkout Humemah-Updated-final-day
Run npm install and npm start to run locally
Clear site data/cache
Log in as admin/owner user
Go to → Other Links → Permission Management → User Roles
Verify that only Owner and Admin users have this permission by default
Go to → Other Links → Permission Management → Manage User Permission
Verify the permission can be added to other users that are not Admin nor Owner
Go to any user's Profile → Basic Information → End Date section
Verify users with permission can see and interact with the "Set Final Day" button

Verify users without permission cannot see the button

Screenshots or videos of changes:

Note:

Include the information the reviewers need to know.

@netlify
Copy link

netlify bot commented Aug 30, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit bb4f095
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/690e94fbc67cbd0008ce21fe
😎 Deploy Preview https://deploy-preview-3991--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@nathanah nathanah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs a backend PR to add this new permission to Owners and to verify that a user has this permission when updating final day.
Still not sure why setFinalDay is different from changeUserStatus...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated src/components/PermissionsManagement/PermissionsConst.jsx - Added new "Set Final Day" permission definition

Where? Looks like this still needs to be done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From PR#3245. The route permissions also need to be updated as in that PR.

      {
        label: 'Set Final Day',
        key: 'setFinalDay',
        description: 'Gives the user permission to set the final working day.',
      },

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the permission Set Final Day for User is already defined in PermissionsConst.jsx

Copy link
Contributor

@nathanah nathanah Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key for that is 'setUserFinalDay' instead of 'setFinalDay' as you're checking. So the key needs to be updated either in your hasPermission() calls or in PermissionsConst and anywhere that actually uses 'setUserFinalDay'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the permission checks are inverted, which probably looks like it's working because it's checking the wrong value.

{!isCurrentUser && (
<>
{!canChangeUserStatus ? (
{!canSetFinalDay ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!canSetFinalDay ? (
{canChangeUserStatus || canSetFinalDay ? (

or

Suggested change
{!canSetFinalDay ? (
{canSetFinalDay ? (
  1. It looks like the logic for this is inverted? (with the '!')
  2. Should changeUserStatus also be controlling this, or should it be fully replaced?

akshith312
akshith312 previously approved these changes Sep 26, 2025
Copy link

@akshith312 akshith312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested PR locally. Performed check by enabling users with permissions to set final day. Works as expected.

Admin able to set final day for self
image
Admin able to set final day for other account:
image
User with permission able to set final day:
image
image
User without permission cannot see the set final day button.
image

Copy link

@ShradhaMBhadrannavar ShradhaMBhadrannavar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried testing this PR locally multiple times but encountered the error shown in the attached screenshot. I followed all the steps mentioned in the “How to Test” section, but the issue persists. Could you please check if there’s something I might be missing or any additional setup required?
Screenshot 2025-10-04 at 19 56 38

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Oct 7, 2025
@sanjeev29
Copy link

sanjeev29 commented Oct 13, 2025

Tested this PR with the latest development branch for backend. I'm able to update permissions for a user who has the role volunteer. For a user with role Admin/Owner, I'm not able to update permissions. But, there's a success message which shows up when I try to update Admin/Owner roles permissions, which I think is misleading. Other, than that the changes work as expected.
Screenshot 2025-10-13 at 5 03 15 PM
PR-3991

@tomkkl
Copy link

tomkkl commented Oct 24, 2025

Hello,
Just wanted to point out something different from others here. The functionality is working as I was able to set/unset final date. However, in this particular example, I am logged in as admin and when I hover over this student, it says that I do not have permission. However, when I actually go ahead and pressed the button, it is working as expected. Just something minor that I wanted to point out.
Screenshot 2025-10-24 at 6 04 33 AM
Screenshot 2025-10-24 at 6 04 08 AM
Screenshot 2025-10-24 at 6 03 36 AM

@humemah
Copy link
Contributor Author

humemah commented Nov 1, 2025

Tested this PR with the latest development branch for backend. I'm able to update permissions for a user who has the role volunteer. For a user with role Admin/Owner, I'm not able to update permissions. But, there's a success message which shows up when I try to update Admin/Owner roles permissions, which I think is misleading. Other, than that the changes work as expected. Screenshot 2025-10-13 at 5 03 15 PM PR-3991

Hello,
Just wanted to point out something different from others here. The functionality is working as I was able to set/unset final date. However, in this particular example, I am logged in as admin and when I hover over this student, it says that I do not have permission. However, when I actually go ahead and pressed the button, it is working as expected. Just something minor that I wanted to point out.

Thanks for noticing! The tooltip shows a minor UI mismatch, but the button works correctly for Admins.

@humemah
Copy link
Contributor Author

humemah commented Nov 2, 2025

I tried testing this PR locally multiple times but encountered the error shown in the attached screenshot. I followed all the steps mentioned in the “How to Test” section, but the issue persists. Could you please check if there’s something I might be missing or any additional setup required?

Thanks for checking! Based on the error message, it looks like a local environment issue rather than a problem with the PR itself.
I recommend deleting node_modules and lock files, then reinstalling dependencies

@Vinay944924
Copy link

Vinay944924 commented Nov 3, 2025

Hi Humemah,
I tested the PR locally.
At first logged in with owner account and the functionality of set final day is working. As i added it to my other account and checked and when I logged in again and deleted it, the functionality is working and it's showing up. I have Provided the screenshots below
PR-3991
PR-3991(1)
PR-3991(2)
PR-3991(3)

@Sriamshreddy000
Copy link

Tested this PR locally and followed the provided test instructions.
In Other Links → Permission Management → User Roles, verified that only Admin and Owner users have this permission by default.
In Manage User Permissions, confirmed that the permission can be added to other users who are not Admin/Owner.
Also verified that users with the permission can see and interact with the “Set Final Day” button, while users without the permission cannot see it. Everything is working as expected.
Attaching a few screenshots for reference.
Screenshot 2025-11-07 at 12 51 02 PM
Screenshot 2025-11-07 at 12 53 02 PM

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 8, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants