Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor user delete permissions to allow StateAdmin and DistrictAdmin #6781

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Dec 3, 2023

Backend PR: coronasafe/care#1738

WHAT

🤖[deprecated] Generated by Copilot at 6ab927b

This pull request proposes changes to the way user deletion privileges are granted. Previously, it was based on the code which is directly visible in the user module file, but now it has been moved to a utility function.

In the FacilityUsers.tsx and ManageUsers.tsx files, the validation for user deletion access was directly placed within the component. However, to ensure cleaner code and avoid duplication, the logic has been moved to the utils.ts file, inside a new function called showUserDelete. As per the function logic, only users who are StateAdmins from the same state as the target user or DistrictAdmins from the same district can delete users.

This pull request hence not only enhances the readability and maintainability of our code but also successfully implements the needed feature of granting user deletion privileges to district admin and above.

Proposed Changes

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

HOW

🤖[deprecated] Generated by Copilot at 6ab927b

No walkthrough available (Limit exceeded: required to process 57580 tokens, but only 50000 are allowed per call)

@Ashesh3 Ashesh3 requested a review from a team as a code owner December 3, 2023 10:13
Copy link

netlify bot commented Dec 3, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit ba9abea
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/657836802046e00008f9e12f
😎 Deploy Preview https://deploy-preview-6781--care-egov-staging.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 site configuration.

Copy link

vercel bot commented Dec 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2023 10:32am

Copy link

cypress bot commented Dec 3, 2023

Passing run #1662 ↗︎

0 88 0 0 Flakiness 0

Details:

Refactor user delete permissions to allow StateAdmin and DistrictAdmin
Project: CARE Commit: 670a172c11
Status: Passed Duration: 02:17 💡
Started: Dec 3, 2023 10:49 AM Ended: Dec 3, 2023 10:51 AM

Review all test suite changes for PR #6781 ↗︎

@Ashesh3 Ashesh3 changed the title Refactor user delete permissions Refactor user delete permissions to allow StateAdmin and DistrictAdmin Dec 3, 2023
Copy link

github-actions bot commented Dec 8, 2023

👋 Hi, @Ashesh3,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit 9967dae into develop Dec 13, 2023
29 of 37 checks passed
@khavinshankar khavinshankar deleted the user-del-perms branch December 13, 2023 05:29
Copy link

@Ashesh3 We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us 🥇. We always welcome your contribution 🙂, so feel free to contribute to anything anytime, and never lose that spirit of innovation 🙌.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Deletion Privilege should be given to district admin and above
3 participants