feat(32.2-01): in-transaction BackendAccessRevokedEvent at every admin access change

- cabana: BackendAccessRevokedEvent with reasons deleted, deactivated,
  password_changed, password_set, password_reset and permissions, fired
  synchronously inside the save's transaction; a listener error rolls back
- fired on admin delete, deactivate, a password set by another admin, an own
  password change, admin:reset-password, a role/permissions/superuser change
  and a role's permission change (every holder); MCPSubjectChanged unchanged
- role delete fires nothing (refused while the role has holders); no sign
  out everywhere action exists
- smoke test TestBackendAccessRevokedSmoke (Postgres)
This commit is contained in:
Jakub Zych
2026-11-21 00:32:26 +01:00
parent 3f7ce6020d
commit fcc7bbde25
10 changed files with 270 additions and 8 deletions

View File

@@ -186,6 +186,10 @@ Administrators are deactivated, deleted and restored, never removed:
When a refused row is part of a bulk selection, the whole selection is rolled back and the refusal is shown.
#### What ends an administrator's OAuth grants
A plugin that issues OAuth grants acting as an administrator (an MCP connector the administrator signed in to, for example) listens for `cabana.BackendAccessRevokedEvent` and revokes those grants in the same transaction as the change. The event fires when the administrator is deleted or deactivated, when they change their own password on My account, when another administrator sets their password, when `admin:reset-password` resets it, and when their role, own permission overrides or superuser flag change, or the permissions of the role they hold change. A listener that fails rolls the save back, so the change never commits while the grants survive. Each connection can also be revoked one by one where the plugin lists it. The admin has no "sign out everywhere" action.
Setting the password of another administrator ends that administrator's sessions at once, as `admin:reset-password` does: tokens issued before the change are refused. Their personal API tokens keep working, exactly as after `admin:reset-password`; revoke them with `admin:token:revoke` when they should stop too.
### The Roles screen