fix: prevent admin users from being assigned to non-superadmin members#1509
Merged
bobcaprice merged 3 commits intoJul 8, 2026
Conversation
DanielPalafox
force-pushed
the
PD-5857_possible-to-create-admin-users-for-non-superadmin-enabled-members_Daniel-Palafox
branch
from
July 8, 2026 13:44
0a07aba to
e306e3a
Compare
bobcaprice
deleted the
PD-5857_possible-to-create-admin-users-for-non-superadmin-enabled-members_Daniel-Palafox
branch
July 8, 2026 13:58
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.
fix: prevent admin users from being assigned to non-superadmin members
UI: reset isAdmin to false when the selected member is switched to one
that does not have superadminEnabled, so the stale value can never be
submitted silently (previously the checkbox was hidden but the form
control kept its true value).
Add a spec that asserts the reset behaviour.
Backend: add a service-layer guard in UserService that throws
BadRequestAlertException when isAdmin=true and the member has
superadminEnabled null or false. Applied in both createUser and
updateUser as defence-in-depth behind the existing UserValidator check.
Add tests for both code paths; correct an existing test that was
inadvertently setting isAdmin=true against a non-superadmin member.
Data fix: add demote_non_superadmin_admins.py (query-fixes) to identify
and correct any admin users already in the database that do not belong
to a superadmin-enabled member (plan → confirm → execute → verify,
--dry-run supported).
Relates to https://orcid.clickup.com/t/9014437828/PD-5857