New accounts only from an administrator or an administrator's invitation

Anyone can add an aircraft and so manage its people, so invitations from
non-administrators could bring in new accounts without an administrator.

- An invitation makes a new account only if whoever made it is still an
  administrator when it's used; an aircraft's Access page invitations are
  for people who already have an account (its welcome page says so).
- Signing invitations no longer make accounts: the mechanic needs one
  first, and the owner is told when they don't have one.
- With SSO, "Continue with <provider>" on an administrator's invitation
  makes the account and accepts the invitation (only for its address when
  it has one), so invitations work without OIDC_AUTO_CREATE_USERS. That
  setting stays, documented as giving accounts without an invitation; the
  Authentik example now leaves it off.
- Docs: who makes accounts (guide, README, Authentik, .env.example, API).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-15 19:00:45 -05:00
1 parent b4c7aaa3ff
commit 19bc3efa19
19 files changed
+159 -85

No files matched your search

+10 -1
View File
@@ -159,6 +159,7 @@ class ElectronicSignaturesTest < ActionDispatch::IntegrationTest
post aircraft_logbook_entry_signing_invitations_path(@a, @entry), params: { signing_invitation: { email: "Outside@Example.com", message: "Thanks!" } }
end
end
assert_match "They don't have an account here yet", flash[:notice]
mail = ActionMailer::Base.deliveries.last
assert_equal [ "outside@example.com" ], mail.to
path = mail.text_part.body.to_s[%r{http://example\.com(/sign/[\w-]+)}, 1]
@@ -166,8 +167,16 @@ class ElectronicSignaturesTest < ActionDispatch::IntegrationTest
get path
assert_includes response.body, "sign in as <strong>outside@example.com</strong>"
assert_includes response.body, "no account for outside@example.com yet" # a signing link doesn't make accounts
post "#{path}/account", params: { name: "Olive Outside", password: "longpassword1", password_confirmation: "longpassword1" }
assert_redirected_to path
assert_response :not_found
assert_not User.exists?(email_address: "outside@example.com")
# The administrator adds their account; they sign in and come back to the link.
User.create!(email_address: "outside@example.com", name: "Olive Outside", password: "longpassword1")
get path
post session_path, params: { email_address: "outside@example.com", password: "longpassword1" }
assert_redirected_to "http://www.example.com#{path}"
follow_redirect!
assert_select "form[action='#{certificates_path(return_to: path)}']" # add a certificate first
post certificates_path(return_to: path), params: { user_certificate: { kind: "IA", number: "2222222" } }