SBCQ-93: Authenticated role, staff user policy, and other tweaks#92
Open
BradyMitch wants to merge 5 commits intomainfrom
Open
SBCQ-93: Authenticated role, staff user policy, and other tweaks#92BradyMitch wants to merge 5 commits intomainfrom
BradyMitch wants to merge 5 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Summary
SBCQ-93
New default
Authenticatedrole instead ofCSR. This role can login and view things, but not edit anything.Added policy for
staff_userresource underutils/policies. This dictates what the signed in user is allowed to do relating to astaff_userrecord. Does not include what they can do with location or counter (these will have their own policies)..VSCode -> Removed deprecated extension
prisma -> New
Authenticatedrole, added staff_user seed data.api login -> Added cache control headers so login page isn't cached. Caused an issue when SSO went down and I had to clear my browser data to login.
api protected / auth middleware / util getAuthContext -> Updated to allow pages to access auth context, not just api routes
hooks -> Removed editable roles hook as this functionality is replaced by security policy
lib/prisma/staff_user -> Updated types from StaffUser to StaffUserWithRelations to include related location and counter
Updated all confirm archive modal components under
components/settings/to have try catch in handleSave and added error message display. Also removed...formDatafrom update functions as we only need to update thedeletedAtfield.Updated all components under
components/settings/that updated or inserted data to usewindow.location.hrefto force a re-fetch of the page's data.src\components\settings\users -> Updates to use the new policy to determine when the user can view, edit, archive, and what roles they can select from when changing a user's role.
🧪 Testing
npm run db:resetandnpm run db:seedto load new database changes.Administrator. You can use this method any time you want to promote yourself to a higher role. For demotion you should use the Queue app.Administrator, you should not be able to archive yourself, but you should be able to see and be able to edit all other users. Finish by changing your role to SDM.SDM, you should see all other users in your location and be able to edit any user with a role equal to or lower than your own. You should not be able to edit Administrators or promote anyone to that role. If you change your location you should not see other users.Authenticatedyou will not be able to edit any users (including your own).🔰 Checklist