mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Invitation codes: a link that gives an account and roles
Ported from the original (InvitationCode), adapted to configurable roles. - Admin → Invitations: a label, optionally one email address (only it can use the link, and it's emailed) and a name, how many uses (or unlimited), an expiry (or never), and a role on any aircraft (or none, for an account only). - An aircraft's Access page: whoever manages its people invites to that aircraft, with only the roles they can give; they see and revoke its invitations. - /join/<code>: shows what it gives; create an account (when password sign-in is on) or sign in, then accept. Existing accounts and SSO users accept too. A role someone already has on an aircraft stays. - Roles are given as the invitation's creator (AircraftAccess), and only while they can still manage that aircraft's people. Codes are kept as digests and shown once; uses are counted under a lock; account creation and accepting are rate-limited; any invalid link gets the same answer. - Docs: guide (Administration, Access & sharing), README, and why /join isn't on the Authentik bypass list. The README's not-yet-ported list now names Prometheus metrics, and no longer claims oil analysis import as new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a645778f26
commit
b4c7aaa3ff
34 files changed
+822
-7
No files matched your search
Generated
+45
-1
@@ -10,7 +10,45 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_11_16_010000) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_11_16_020000) do
|
||||
create_table "access_invitation_redemptions", force: :cascade do |t|
|
||||
t.integer "access_invitation_id", null: false
|
||||
t.integer "user_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["access_invitation_id", "user_id"], name: "index_access_invitation_redemptions_unique", unique: true
|
||||
t.index ["access_invitation_id"], name: "index_access_invitation_redemptions_on_access_invitation_id"
|
||||
t.index ["user_id"], name: "index_access_invitation_redemptions_on_user_id"
|
||||
end
|
||||
|
||||
create_table "access_invitation_roles", force: :cascade do |t|
|
||||
t.integer "access_invitation_id", null: false
|
||||
t.integer "aircraft_id", null: false
|
||||
t.integer "role_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["access_invitation_id", "aircraft_id"], name: "index_access_invitation_roles_unique", unique: true
|
||||
t.index ["access_invitation_id"], name: "index_access_invitation_roles_on_access_invitation_id"
|
||||
t.index ["aircraft_id"], name: "index_access_invitation_roles_on_aircraft_id"
|
||||
t.index ["role_id"], name: "index_access_invitation_roles_on_role_id"
|
||||
end
|
||||
|
||||
create_table "access_invitations", force: :cascade do |t|
|
||||
t.string "label", null: false
|
||||
t.string "email"
|
||||
t.string "name"
|
||||
t.string "token_digest", null: false
|
||||
t.integer "max_uses"
|
||||
t.integer "uses_count", default: 0, null: false
|
||||
t.datetime "expires_at"
|
||||
t.datetime "revoked_at"
|
||||
t.integer "created_by_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["created_by_id"], name: "index_access_invitations_on_created_by_id"
|
||||
t.index ["token_digest"], name: "index_access_invitations_on_token_digest", unique: true
|
||||
end
|
||||
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
@@ -950,6 +988,12 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_16_010000) do
|
||||
t.index ["major_record_id"], name: "index_weight_balance_records_on_major_record_id"
|
||||
end
|
||||
|
||||
add_foreign_key "access_invitation_redemptions", "access_invitations"
|
||||
add_foreign_key "access_invitation_redemptions", "users"
|
||||
add_foreign_key "access_invitation_roles", "access_invitations"
|
||||
add_foreign_key "access_invitation_roles", "aircraft"
|
||||
add_foreign_key "access_invitation_roles", "roles"
|
||||
add_foreign_key "access_invitations", "users", column: "created_by_id"
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "ad_alerts", "aircraft"
|
||||
|
||||
Reference in new issue
Block a user