<% content_for :title, "Users" %>

Users

<%= link_to "+ New User", new_admin_user_path, class: "btn-primary" %>
<% @users.each do |u| %><% end %>
NameEmailAircraftLast sign-in
<%= u.name %> <% if u.admin? %>Admin<% end %><% if u.sso_uid? %> <%= Sso.label %><% end %><% if u.otp_enabled? %> 2FA<% end %><% if u.locked? %> Locked<% end %> <%= u.email_address %><% if u.certificates.any? %>
<%= u.certificates.map { "#{_1.short_label} #{_1.number}" }.join(", ") %>
<% end %>
<%= u.aircraft_roles.map { "#{_1.aircraft.tail_number} (#{_1.role})" }.join(", ").presence || "—" %> <%= u.last_signed_in_at ? "#{time_ago_in_words(u.last_signed_in_at)} ago" : "never" %> <% if u.disabled? %>Disabled<%= button_to "Enable", enable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %> <% elsif u != current_user %><%= button_to "Disable", disable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline", data: { turbo_confirm: "Disable #{u.email_address}? They'll be signed out and can't sign in or sign entries. Their past signatures are kept." } } %><% end %> <% if u.locked? %><%= button_to "Unlock", unlock_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %><% end %> <% if u.otp_enabled? %><%= button_to "Reset 2FA", reset_two_factor_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", title: "Turn off their authenticator app (lost phone)", form: { class: "inline", data: { turbo_confirm: "Turn off two-factor for #{u.email_address}? Only do this after confirming it's really them." } } %><% end %> <%= link_to "Edit", edit_admin_user_path(u), class: "btn-secondary btn-sm" %>

After creating an account, an aircraft owner can grant access from the aircraft's “Access & Sharing” tab.