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

Resolves #809 Prevents org admins from removing their admin role #1027

Merged
merged 6 commits into from
Feb 17, 2023
Merged

Conversation

jdaigneau5
Copy link
Collaborator

Closes Issue #809

Summary

Added logic to prevent org admin users from self demoting and removing their own admin role.

Important Changes

error.js

  • Added new error notAllowedToSelfDemote with message 'Please have another admin user from your organization change your role.'

org.controller.js

  • In updateUser function, changed forEach loop to for...in so returning errors breaks out of function
  • Throws notAllowedToSelfDemote when user tries to remove their own admin role

Testing

Steps to manually test updated functionality, if possible

  • 1) Create new org with an admin user
  • 2) Attempt to remove the admin role from this user, while using that user's credentials

@jdaigneau5 jdaigneau5 requested review from brettp and slubar February 14, 2023 17:24
@jdaigneau5 jdaigneau5 linked an issue Feb 14, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explore whether to prohibit self-demotion
2 participants