Only invited people get an account; removing a member ends their access #82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "invited-sign-up"
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?
What this does
Two access changes, one branch.
1. Only invited people get an account
SALT_DNS_OIDC_AUTO_CREATEnow takestrue,falseorinvited. Anything else stops the boot (RuntimeConfig).trueandfalsework as before.With
invited:subonly; a clash is stillemail_takenand the invitation stays pending.invitations(migration20261125090000): organisation, citext e-mail (same type asusers.email), role, invited_by, expires_at (default 14 days), accepted_at, revoked_at, plus revoked_by and accepted_user for the record. A new table only, so the old code runs fine while it is applied.UserNotifieronly has the sign-in link and the address-change mail), and releases run withmail_deliveryfalse. The page says the inviter tells the person, with the sign-in address.changestable is per zone). The invitation row records who invited, who revoked, who accepted and when, and each of the three writes one info log line with ids (never the address).Who may create an organisation under
invitedOnly a user who is an owner of some organisation. Installations that are not
invitedare unchanged (anyone). Before this, any user with no membership was shown a form to create an organisation, and the provider was the only gate. Underinvited, a person invited as admin, editor or viewer, or a person with no membership, cannot. This is the smallest rule that closes "anyone the provider lets in makes an organisation". Provisioning tokens and parent organisations are not involved: they create child organisations through the API, which is a different path. Enforced inAccounts.create_organisation/2(so a forged event fails too) and hidden on the organisations page.Operator commands
SaltDns.Release.create_organisation(name)andSaltDns.Release.invite(email, organisation_id, role), documented indocs/operations.md. A freshinvitedinstallation has no organisation and no owner, so the operator makes the organisation and invites its first owner. (create_organisation/1is one more than asked; without it a fresh installation has no way in.)2. Removing a membership ends the person's access
delete_all_user_session_tokens/1(all sessions end, open pages disconnect).What LiveViews did before:
Console.Hooks.load_orgreads the organisation, role andadmin?once, inon_mount. Actions (SaltDns.Access) read the memberships from the database on every call, so a removed or demoted person could not change anything. But the page kept showing the old role and organisation data, and kept receiving updates, until it was reloaded. Now the disconnect makes the browser remount, andload_orgthen sends them away or loads the lower rights. There is no organisation deletion in the code, so no path to cover there; there is no member API either.A release task runs in its own VM without the PubSub, so the console is the path that disconnects pages (as with
sign_out_user).Switching it on
Set
SALT_DNS_OIDC_AUTO_CREATE=invitedand restart. Existing users keep their accounts and memberships. Nothing is changed for them. Run the migration first (the normal deploy does). Recommended for a public installation.Tests
New:
test/salt_dns/accounts_invitations_test.exs,test/salt_dns_web/live/console/invitations_test.exs,test/salt_dns_web/oidc_invited_test.exs; extended:release_test.exs,runtime_config_test.exs. All database tests are:integration. Run locally with--include integrationon the workstation Postgres (partitioninvited): 245 passed (the new files plus the existing member, OIDC, accounts, release, docs and back-channel tests).Format,
compile --warnings-as-errorsandcredo --strictare clean.Not verified: a real identity provider (the tests use the mock provider); the live installation.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DnYzaTxC2GmdSpvCNyHNne