LastSuperAdminGuard
class LastSuperAdminGuard (View source)
The last-super-admin rule for writes that take super admin away from users without touching their account: template contents, group membership, group deletion and a group's template. Each one decides and writes in one transaction holding the super admin rows, so two concurrent changes cannot both pass.
Constants
| ERR_LAST_ADMIN_DEMOTE |
|
| MESSAGE |
|
Methods
No description
Writes unless $change would leave no active super admin. Returns the refusal, or what $write returned.
The refusal when $change would leave no active super admin; meant to run under underLock().
Runs a last-admin check and the write it protects in one transaction. A refusal array or false rolls back, anything else commits. Without a transaction port it runs bare.
Details
__construct(UserPermissionReadInterface $users, TransactionInterface|null $transaction = null)
No description
mixed
guard(UberuserChange $change, callable $write)
Writes unless $change would leave no active super admin. Returns the refusal, or what $write returned.
array|null
refusal(UberuserChange $change)
The refusal when $change would leave no active super admin; meant to run under underLock().
mixed
underLock(callable $work)
Runs a last-admin check and the write it protects in one transaction. A refusal array or false rolls back, anything else commits. Without a transaction port it runs bare.