feat(admin): manage system administrators #43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/admin-administrators"
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?
Summary
Changes
/admin/administrators: the administrators with whether each has a second factor (one without is read-only), a form to add one by email, the invitations with where they stand (invited, needs a second factor, expired) and a way to withdraw them, and a demote link.server_invitations, reversible migration, token stored only as a SHA-256): a single-use link shown once, valid for 7 days, to/server-invites/:token. The accept page creates the account whateverTRAEFIK_CONTROL_SIGNUPsays, or accepts as the logged-in invitee. The invitee becomes a system administrator only once they have a second factor, within 7 days of accepting.Administrators.activate_pending/1, idempotent and claimed with a conditional update). The invitee's two-factor page says what is waiting for them.SELECT ... FOR UPDATEon PostgreSQL, chosen at compile time; SQLite has one writer), so two demotions at once cannot leave none. Everything also needsAdmin.authorize_change/1in the context.administrator.promoted,.invited,.invitation_revoked,.demoted, and, done by the system,.invitation_acceptedand.activated.Admin.Email).Verification
mix precommit: exit 0.mix credo --strict: no issues.mix dialyzer: passed.mix test: 1762 passed on SQLite and on PostgreSQL; migration rollback and re-apply clean on both.new.admin@example.comfrom the page, logged out and opened the link as that person (sign-up is closed), created the account (not an administrator:/adminrefused them), opened their two-factor page (the notice was there), confirmed an authenticator app (flash "You are a system administrator now", the notice gone, the invitation no longer listed), then demoted the first account from the page. The audit page listed invited, invitation accepted (system), activated (system) and demoted.Notes