fix(auth): enforce role ceiling on create_user (PMS-503) #380
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-503-create-user-role-ceiling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
create_user gated only on
is_admin()and then boundrequest.rolestraight into the INSERT, so a tenant
admincould mint a brand-newsuper_adminaccount (a platform-level row with cross-tenant/tenantsaccess). This mirrors the missing ceiling in update_user and is
inconsistent with the invitations flow, which already excludes
super_adminfrom grantable roles.Add
UserRole::privilege_rank/UserRole::can_grantto the sharedtypes crate and enforce it in the create_user handler: a caller may only
create a user whose role is at or below their own privilege, so
super_admin(the only rank-3 role) can only be granted by an existingsuper_admin.#PMS-503