VRMS icon indicating copy to clipboard operation
VRMS copied to clipboard

Create ability for Admins to promote and demote Admins

Open trillium opened this issue 1 year ago • 0 comments

Overview

This issue is in reference to #1273

Right now the only avenue to promote a user to admin level is to ping someone with DB access and have them promote the account. Not ideal.

Action Items

The EditUser accessbile by an admin needs the ability to promote and demote admins. Here's the short list:

PR Needs

  • [ ] Promote a user to an admin
  • [ ] Remove a user's admin status
    • [ ] But not the admin that promoted you
  • [ ] Remove self admin status

This will require both front end and back end edits

Front end edits:

  • [ ] Create AdminStatus component rendered on the EditUsers page
    • [ ] Displays
    • [ ] This field is disabled if the current admin is viewing the User page of the admin that promoted them. For now, model this off of the isActive component:
// client/src/components/user-admin/EditUsers.js
<FormGroup>
  <FormControlLabel control={<Switch checked={isActive} />} onClick={() => handleSetIsActive()} />
</FormGroup>
  • [ ] Create function within UserApiService:
    • [ ] UpdateUserAdminStatus This function edits the user's admin status and stores the the user id _id of the admin that promoted them.

Back end edits:

  • [ ] update user.model.js to have an adminPromotedBy property of type string
  • [ ] apply the update to the user model to across the db

Resources

This task is fairly similar to #1452 , so feel free to use that PR's code as a model for how to do this PR.

trillium avatar Aug 27 '23 23:08 trillium