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

Fix bug where org_admins couldn't promote users #4729

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

coalest
Copy link
Collaborator

@coalest coalest commented Oct 22, 2024

Resolves #4724

Description

#4701 fixed an issue where super admins couldn't promote a user (#4664), but in the process broke user promotion for organization admins.

This is because the fix in #4701 directed super admins to the admin edit user path, which organizational admins don't have access to (and shouldn't I think?).

The reason super admins couldn't originally promote users was because current_organization was being called here, which for super admins was evaluating to nil. The fix here adds the organization_name as a parameter to those promotion/demotion requests so that current_organization will evaluate correctly.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Changes:
- Organization admins can now promote users
- Super admins can now demote users
- There is now a notice "User has been demoted!" when users are demoted.

How Has This Been Tested?

Added request and system specs.

@coalest
Copy link
Collaborator Author

coalest commented Oct 22, 2024

First PR for this project, let me know if I missed anything!

@cielf cielf requested review from dorner, cielf and awwaiid October 22, 2024 11:47
dorner
dorner previously requested changes Oct 22, 2024
app/views/users/_organization_user.html.erb Show resolved Hide resolved
app/views/users/_organization_user.html.erb Show resolved Hide resolved
spec/system/admin/organizations_system_spec.rb Outdated Show resolved Hide resolved
@coalest
Copy link
Collaborator Author

coalest commented Oct 22, 2024

@dorner It's ready for another round of review

Screenshot when signed in as super admin:
Screenshot from 2024-10-22 16-40-49

Screenshot when signed in as org admin:
Screenshot from 2024-10-22 16-39-55

@coalest coalest requested a review from dorner October 22, 2024 15:36
@dorner
Copy link
Collaborator

dorner commented Oct 23, 2024

Technical looks good - over to @cielf for functional since the implementation has changed.

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@cielf cielf dismissed dorner’s stale review October 23, 2024 16:31

@dorner gave his technical blessing to all, dismissing review to be able to merge.

@cielf cielf merged commit 51272ad into rubyforgood:main Oct 23, 2024
11 checks passed
Copy link
Contributor

@coalest: Your PR Fix bug where org_admins couldn't promote users is part of today's Human Essentials production release: 2024.10.27.
Thank you very much for your contribution!

@coalest coalest deleted the 4724-fix-org-admin-promote-user-bug branch November 29, 2024 13:17
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.

[BUG] Organization Admins can't currently promote users to admin status
3 participants