mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
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:
1 parent
b4c7aaa3ff
commit
19bc3efa19
19 files changed
+159
-85
No files matched your search
+6
-4
@@ -29,7 +29,7 @@ OIDC_CLIENT_SECRET=...
|
||||
OIDC_PROVIDER_NAME=Authentik
|
||||
# Optional:
|
||||
OIDC_ADMIN_GROUP=aircraft-admins # members become app admins; others lose admin at sign-in
|
||||
OIDC_AUTO_CREATE_USERS=true # create an account at first sign-in (new accounts have no aircraft)
|
||||
OIDC_AUTO_CREATE_USERS=false # true: an account for anyone Authentik lets in, without an invitation
|
||||
```
|
||||
|
||||
Restart the app. The first SSO sign-in links an existing account with the same email if Authentik marks the email verified. Otherwise sign in with the password and use **Profile → Link Authentik**.
|
||||
@@ -77,7 +77,7 @@ For domain-level forward auth, Authentik matches each line as a regular expressi
|
||||
^https://aircraft\.example\.com/assets/.+$
|
||||
^https://aircraft\.example\.com/shared/[A-Za-z0-9]{32}(/report)?$
|
||||
^https://aircraft\.example\.com/rails/active_storage/(blobs/redirect|disk)/.+$
|
||||
^https://aircraft\.example\.com/sign/[A-Za-z0-9_-]{43}(/account)?$
|
||||
^https://aircraft\.example\.com/sign/[A-Za-z0-9_-]{43}$
|
||||
^https://aircraft\.example\.com/session(/new|/two_factor)?(\?.*)?$
|
||||
^https://aircraft\.example\.com/profile/certificates(\?.*)?$
|
||||
^https://aircraft\.example\.com/profile/two_factor(/new|/recovery_codes)?(\?.*)?$
|
||||
@@ -93,13 +93,15 @@ What each group is for:
|
||||
| `/assets/…` | Styles and scripts for share pages and the signing pages | Static files with no data |
|
||||
| `/shared/<token>`, `/shared/<token>/report` | Read-only share links (Access & Sharing) | Only with a valid, unexpired, unrevoked 32-character token, and only what that link's level shows |
|
||||
| `/rails/active_storage/blobs/redirect/…`, `/rails/active_storage/disk/…` | The aircraft picture and shared documents on share pages | A file only to someone holding its signed link (from a page they could see). Disk links expire after a few minutes; redirect links don't, so a forwarded link keeps working |
|
||||
| `/sign/<token>`, `/sign/<token>/account` | Outside mechanics signing an entry from an emailed invitation | Only with a valid, unused invitation token (43 characters, 14-day expiry, stored as a fingerprint) |
|
||||
| `/sign/<token>` | Outside mechanics signing an entry from an emailed invitation (with an account they already have) | Only with a valid, unused invitation token (43 characters, 14-day expiry, stored as a fingerprint) |
|
||||
| `/session`, `/session/new`, `/session/two_factor` | The app's own sign-in, for invited mechanics | The sign-in page. Protected by rate limits, the account lockout (10 failures lock an account for 15 minutes) and optional authenticator codes. A signed-in app account still can't reach any other page through the proxy |
|
||||
| `/profile/certificates` | Invited mechanics adding their certificate before signing | Adding a certificate to their own account; it only returns to a `/sign/…` page |
|
||||
| `/profile/two_factor…` | Invited mechanics setting up an authenticator app | Their own two-factor setup |
|
||||
| `/help/records` | The "How signing works" link on the signing form | The signing instructions, for signed-in accounts |
|
||||
| `/calendar/<token>.ics` | Calendar apps fetching the due-items feed (Profile → Calendar feed) | The due list of that user's aircraft, only with their secret 32-character token; making a new link retires the old one |
|
||||
|
||||
New accounts come only from an administrator or an administrator's invitation: opening the invitation link, then **Continue with Authentik**, makes the account and accepts it. With `OIDC_AUTO_CREATE_USERS=true` instead, anyone Authentik lets in gets an account (with no aircraft) without an invitation.
|
||||
|
||||
Invitation links (`/join/…`) are deliberately not on the list: behind forward auth, someone with only an app account still couldn't get past the proxy to use the app, so invited people need an Authentik account anyway. They sign in to Authentik, then open the link and accept it.
|
||||
|
||||
Leave out lines for features you don't use: without share links drop `/shared` and Active Storage; without calendar feeds drop `/calendar`; if mechanics never sign through invitations drop `/sign`, `/session`, `/profile/…` and `/help/records`.
|
||||
@@ -112,7 +114,7 @@ In a private window:
|
||||
|
||||
1. `https://aircraft.example.com/` should go to Authentik.
|
||||
2. A share link should open without signing in, styled, with the aircraft picture.
|
||||
3. A signing invitation should let you create an account (or sign in), add a certificate and sign.
|
||||
3. A signing invitation should let you sign in (with an existing account), add a certificate and sign.
|
||||
4. After that, `https://aircraft.example.com/aircraft` in the same window should still go to Authentik.
|
||||
|
||||
### Client addresses
|
||||
|
||||
@@ -28,9 +28,9 @@ To give someone a role on any aircraft, open them in **Admin → Users**: **Airc
|
||||
|
||||
## Invitations
|
||||
|
||||
**Admin → Invitations → New invitation** makes a link someone opens to create their own account (or accept with the one they have) and get roles on aircraft: a label for you, optionally an email address (then only that address can use it, and the link is emailed to it when email is set up) and a name, how many times it works (empty for unlimited, e.g. for a flying club), when it expires (empty for never), and a role on any of the aircraft (none at all gives just an account). The link is shown once, when it's made; copy it then.
|
||||
**Admin → Invitations → New invitation** makes a link someone opens to create their own account (or accept with the one they have) and get roles on aircraft. New accounts are only ever made by an administrator: here, from **Users**, or by an administrator's invitation (invitations from an aircraft's Access page are for people who already have an account, and so are signing invitations). An invitation has a label for you, optionally an email address (then only that address can use it, and the link is emailed to it when email is set up) and a name, how many times it works (empty for unlimited, e.g. for a flying club), when it expires (empty for never), and a role on any of the aircraft (none at all gives just an account). The link is shown once, when it's made; copy it then.
|
||||
|
||||
Where someone already has a role on an aircraft, an invitation leaves it as it is. An invitation never gives more than whoever made it can give when it's used. **Revoke** stops a link working; people who already used it keep their access. With sign-in by single sign-on only, people accept invitations after signing in with it.
|
||||
Where someone already has a role on an aircraft, an invitation leaves it as it is. An invitation never gives more than whoever made it can give when it's used. **Revoke** stops a link working; people who already used it keep their access. With single sign-on, **Continue with** on the invitation page signs them in and makes their account. `OIDC_AUTO_CREATE_USERS=true` in the server's settings instead gives an account to anyone the provider lets in, without an invitation; leave it off to keep accounts to administrators and their invitations.
|
||||
|
||||
## Account recovery from the command line
|
||||
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ POST /api/v1/aircraft/12/draft_batches
|
||||
- **One entry per logbook.** Items are grouped by `log` (`AC`, `ENG`, `PROP` or `OTHER`) into one unsigned entry each, their texts in order, so a visit that touched the engine and the airframe makes two entries, signed one after the other.
|
||||
- **Inspections** (`completes_inspections`): each needs its `result`, `approved` (airworthy) or `discrepancies` (a list was given to the owner), and the draft needs `aircraft_hours`. The entry recording it is an inspection entry, in the logbook named by `log`, else the airframe log if an item is for it.
|
||||
- **Nothing is resolved until it's signed.** The squawks the items resolve and the inspections they complete are held until **every** entry of the draft is signed; then they're resolved and recorded, attributed to the person who signed last, and linked to the entry that described the work. A draft never clears a squawk on its own. The signer sees what signing will do before they sign.
|
||||
- **The signer.** Anyone with access to the aircraft and a certificate in their profile can sign, from each entry's `sign_url`. Give `signer.email` for someone else (a mechanic without an account): each entry then gets an `invitation_url`, a link that lets that person create an account for that address and sign that entry, for 14 days. Pass the link on yourself (for example inside Redmine), or set `send_email: true` to have SAM email it.
|
||||
- **The signer.** Anyone with access to the aircraft and a certificate in their profile can sign, from each entry's `sign_url`. Give `signer.email` for someone else (a mechanic who isn't on the aircraft): each entry then gets an `invitation_url`, a link that lets that person sign that entry with their account for that address, for 14 days. They need an account first (the administrator adds it, or invites them). Pass the link on yourself (for example inside Redmine), or set `send_email: true` to have SAM email it.
|
||||
|
||||
The answer (`201`):
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ A signed entry can't be edited or deleted. Open it and choose **More → Correct
|
||||
|
||||
## Someone else did the work
|
||||
|
||||
The owner can choose **More → Ask someone to sign** on the entry. The mechanic gets a one-time email link (valid for 14 days), signs in or creates their own account, adds their certificate and signs.
|
||||
The owner can choose **More → Ask someone to sign** on the entry. The mechanic gets a one-time email link (valid for 14 days), signs in with their own account (the administrator adds it first, or invites them), adds their certificate and signs.
|
||||
|
||||
If they prefer paper, print the entry (**Print for logbook**), have it signed in ink, and keep the paper with the logbooks (scan it into Documents).
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Only an Owner can give or take away the Owner role, nobody can change their own,
|
||||
|
||||
## Invitations
|
||||
|
||||
To add someone who has no account yet, or without knowing their email, use **Invitations** on the same page: choose the role, optionally their email (then only they can use it, and it's emailed to them when email is set up), how many times it works and when it expires, then **Create invitation**. Copy the link shown and send it; it isn't shown again. Whoever opens it creates an account, or signs in, and gets the role on this aircraft. **Revoke** stops a link that hasn't been used. Administrators can also make invitations for several aircraft at once (Admin → Invitations).
|
||||
To bring in someone who has an account, without knowing their email, use **Invitations** on the same page (new accounts are made only by the administrator or an administrator's invitation, so ask the administrator for someone who has no account yet): choose the role, optionally their email (then only they can use it, and it's emailed to them when email is set up), how many times it works and when it expires, then **Create invitation**. Copy the link shown and send it; it isn't shown again. Whoever opens it creates an account, or signs in, and gets the role on this aircraft. **Revoke** stops a link that hasn't been used. Administrators can also make invitations for several aircraft at once (Admin → Invitations).
|
||||
|
||||
## Share links
|
||||
|
||||
|
||||
Reference in new issue
Block a user