Configurable roles: Owner, Mechanic, Pilot, Viewer and custom roles

What people can do on an aircraft now comes from their role there, and
administrators set what each role allows (Admin → Roles).

- Roles are installation-wide sets of permissions (31, grouped as flying,
  squawks and notes, maintenance records, imports and exports, the
  aircraft, notifications). Seeing an aircraft's records needs none.
- Built in: Owner (always every permission, so an aircraft can always be
  managed), Mechanic (shop maintenance: logbook, signing, components,
  inspections, ADs, squawks, reminders), Pilot (what pilots could do
  before) and Viewer (view only). Administrators can change all but
  Owner's, and add their own; a role can be deleted once nobody has it.
- Existing owners and pilots keep exactly what they could do.
- Admin → Users → a user lists their role on every aircraft, to change,
  remove or add. On the aircraft's Access page, anyone who manages people
  hands out roles, but only an Owner can give or take away Owner, nobody
  changes their own (except administrators), and an aircraft always
  keeps an Owner (AircraftAccess).
- Controllers declare the permission each action needs; a request that
  changes something with none declared is refused (and raises in
  development and tests), and a test walks every route to check.
- Weekly reminders and overdue alerts go to roles that get reminders;
  the DRS reminder also needs Manage ADs. The API follows the person's
  role; its owners_only error is now not_permitted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-15 17:43:38 -05:00
1 parent d2cd60c6a7
commit d8cd462194
101 files changed
+1032 -232

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
# search terms used.
class AdAlertsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_ads
before_action :set_alert, only: %i[track dismiss]
rate_limit to: 5, within: 1.minute, only: :check, with: -> { redirect_to aircraft_airworthiness_directives_path(@aircraft), alert: t("flash.ad_alerts.try_again_in_a") }
+1 -1
View File
@@ -1,6 +1,6 @@
class AdCompliancesController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_ads
before_action :set_compliance, only: %i[edit update destroy]
def new
+1 -1
View File
@@ -2,7 +2,7 @@
class AdImportsController < ApplicationController
include AircraftScoped
include StoredUpload
before_action :require_owner!
requires_permission :manage_ads
def new; end
+57
View File
@@ -0,0 +1,57 @@
# The roles people can have on an aircraft and what each allows (Role,
# Permission). Owner always has every permission; the other built-in roles
# can be changed but not deleted; administrators can add their own.
class Admin::RolesController < ApplicationController
before_action :require_admin!
before_action :set_role, only: %i[edit update destroy]
def index
Role.ensure_built_in!
@roles = Role.ordered
@counts = AircraftRole.group(:role_id).count
end
def new
@role = Role.new(permissions: Permission::DEFAULTS["viewer"])
end
def create
@role = Role.new(role_params)
if @role.save
redirect_to admin_roles_path, notice: t("flash.admin_roles.created", name: @role.name)
else
render :new, status: :unprocessable_entity
end
end
def edit; end
def update
attributes = @role.owner? ? role_params.except(:permissions) : role_params
if @role.update(attributes)
redirect_to admin_roles_path, notice: t("flash.admin_roles.updated", name: @role.name)
else
render :edit, status: :unprocessable_entity
end
end
def destroy
if @role.built_in?
redirect_to admin_roles_path, alert: t("flash.admin_roles.built_in")
elsif @role.aircraft_roles.exists?
redirect_to admin_roles_path, alert: t("flash.admin_roles.in_use", name: @role.name, count: @role.aircraft_roles.count)
else
@role.destroy!
redirect_to admin_roles_path, notice: t("flash.admin_roles.deleted", name: @role.name)
end
end
private
def set_role = @role = Role.find(params[:id])
# Unticking every box sends none, so an empty list is always sent too.
def role_params
params.require(:role).permit(:name, :description, permissions: []).tap { _1[:permissions] = Array(_1[:permissions]).compact_blank }
end
end
@@ -0,0 +1,31 @@
# Administrators give people roles on any aircraft (from Admin → Users),
# under the same rules as the aircraft's Access page (AircraftAccess).
class Admin::UserAircraftRolesController < ApplicationController
before_action :require_admin!
before_action :set_user
def create
aircraft = Aircraft.find_by(id: params[:aircraft_id])
return back(alert: t("services.aircraft_access.not_found")) unless aircraft
back_with AircraftAccess.new(aircraft, actor: current_user).add(@user, Role.find_by(id: params[:role_id])),
t("flash.admin_users.access_added", tail_number: aircraft.tail_number)
end
def update
membership = @user.aircraft_roles.find(params[:id])
back_with AircraftAccess.new(membership.aircraft, actor: current_user).change(membership, Role.find_by(id: params[:role_id])),
t("flash.admin_users.access_changed", tail_number: membership.aircraft.tail_number)
end
def destroy
membership = @user.aircraft_roles.find(params[:id])
back_with AircraftAccess.new(membership.aircraft, actor: current_user).remove(membership),
t("flash.admin_users.access_removed", tail_number: membership.aircraft.tail_number)
end
private
def set_user = @user = User.find(params[:user_id])
def back(flash) = redirect_to(edit_admin_user_path(@user, anchor: "access"), flash)
def back_with(error, notice) = back(error ? { alert: error } : { notice: notice })
end
+1 -1
View File
@@ -3,7 +3,7 @@ class Admin::UsersController < ApplicationController
before_action :set_user, only: %i[edit update destroy disable enable unlock reset_two_factor]
def index
@users = User.order(:email_address).includes(:certificates, aircraft_roles: :aircraft)
@users = User.order(:email_address).includes(:certificates, aircraft_roles: %i[aircraft role])
end
def new
@@ -1,6 +1,7 @@
# Download the aircraft's flights as an AirTrail import file.
class AirTrailExportsController < ApplicationController
include AircraftScoped
requires_permission :log_flights
def new
@export = build_export
+4 -2
View File
@@ -1,7 +1,9 @@
class AircraftController < ApplicationController
include AircraftScoped
skip_before_action :set_aircraft, only: %i[index new create]
before_action :require_owner!, only: %i[edit update destroy]
skip_before_action :set_aircraft, :authorize_permission!, only: %i[index new create]
requires_permission :edit_aircraft, only: %i[edit update]
requires_permission :delete_aircraft, only: :destroy
requires_permission :update_hours, only: :update_hours
def index
@aircraft_list = current_user.accessible_aircraft.ordered.with_attached_picture
@@ -1,7 +1,7 @@
# Download an aircraft as a .sam.zip archive (owners and admins).
class AircraftExportsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :export_data
EXPORT_DIR = Rails.root.join("tmp/exports")
+17 -34
View File
@@ -1,54 +1,37 @@
# Owner-only: manage who can access the aircraft, and its public share links.
# Who can access the aircraft, with which role ("manage people"), and its
# public share links ("manage sharing", see ShareTokensController). The rules
# for changing roles are in AircraftAccess.
class AircraftRolesController < ApplicationController
include AircraftScoped
before_action :require_owner!
checks_permission_itself only: :index
requires_permission :manage_people, only: %i[create update destroy]
def index
@roles = @aircraft.roles.includes(:user).order(:role, :created_at)
return permission_denied unless can?(:manage_people) || can?(:manage_sharing) || can?(:export_data)
@access = AircraftAccess.new(@aircraft, actor: current_user)
@roles = @aircraft.roles.includes(:user, :role).joins(:role).order("roles.position", :created_at)
@share_tokens = @aircraft.share_tokens.order(created_at: :desc).includes(:created_by)
end
def create
user = User.find_by(email_address: params[:email_address].to_s.strip.downcase)
unless user
return redirect_to aircraft_aircraft_roles_path(@aircraft),
alert: t("flash.aircraft_roles.no_user_with_that")
end
role = @aircraft.roles.new(user: user, role: params[:role])
if role.save
log_event("role", t("flash.aircraft_roles.added_as", display_name: user.display_name, role: role.role))
redirect_to aircraft_aircraft_roles_path(@aircraft), notice: t("flash.aircraft_roles.added", display_name: user.display_name)
else
redirect_to aircraft_aircraft_roles_path(@aircraft), alert: role.errors.full_messages.to_sentence
end
return back(alert: t("flash.aircraft_roles.no_user_with_that")) unless user
error = access.add(user, Role.find_by(id: params[:role_id]))
back(error ? { alert: error } : { notice: t("flash.aircraft_roles.added", display_name: user.display_name) })
end
def update
role = @aircraft.roles.find(params[:id])
if demoting_last_owner?(role, params[:role])
return redirect_to aircraft_aircraft_roles_path(@aircraft), alert: t("flash.aircraft_roles.an_aircraft_must_keep")
end
role.update!(role: params[:role])
log_event("role", t("flash.aircraft_roles.changed_to", display_name: role.user.display_name, role: role.role))
redirect_to aircraft_aircraft_roles_path(@aircraft), notice: t("flash.aircraft_roles.role_updated")
error = access.change(@aircraft.roles.find(params[:id]), Role.find_by(id: params[:role_id]))
back(error ? { alert: error } : { notice: t("flash.aircraft_roles.role_updated") })
end
def destroy
role = @aircraft.roles.find(params[:id])
if role.user == current_user
return redirect_to aircraft_aircraft_roles_path(@aircraft), alert: t("flash.aircraft_roles.you_can_t_remove")
end
if demoting_last_owner?(role, nil)
return redirect_to aircraft_aircraft_roles_path(@aircraft), alert: t("flash.aircraft_roles.an_aircraft_must_keep_2")
end
role.destroy!
log_event("role", t("flash.aircraft_roles.removed", display_name: role.user.display_name))
redirect_to aircraft_aircraft_roles_path(@aircraft), notice: t("flash.aircraft_roles.access_removed")
error = access.remove(@aircraft.roles.find(params[:id]))
back(error ? { alert: error } : { notice: t("flash.aircraft_roles.access_removed") })
end
private
def demoting_last_owner?(role, new_role)
role.role == "owner" && new_role != "owner" && @aircraft.roles.owners.count <= 1
end
def access = AircraftAccess.new(@aircraft, actor: current_user)
def back(flash) = redirect_to(aircraft_aircraft_roles_path(@aircraft), flash)
end
+1 -1
View File
@@ -1,7 +1,7 @@
# Flights → Standardize airport codes (owners).
class AirportCodesController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :edit_any_flight
def show
@standardizer = AirportCodeStandardizer.new(@aircraft)
@@ -1,14 +1,14 @@
class AirworthinessDirectivesController < ApplicationController
include AircraftScoped
include Applicability
before_action :require_owner!, except: :index
requires_permission :manage_ads, except: :index
before_action :set_ad, only: %i[edit update destroy]
def index
@rows = Compliance.ad_rows(@aircraft)
@history = AdCompliance.for_aircraft(@aircraft).recent_first
.includes(:component, :logbook_entry, airworthiness_directive: :document, inspection_record: :inspection_type)
@attachable = AirworthinessDirective.where.not(id: @aircraft.applicable_ads.select(:id)).ordered if owner?
@attachable = AirworthinessDirective.where.not(id: @aircraft.applicable_ads.select(:id)).ordered if can?(:manage_ads)
@alerts = @aircraft.ad_alerts.pending
end
+6 -2
View File
@@ -70,8 +70,12 @@ module Api
def find_aircraft(id = params[:aircraft_id]) = aircraft_scope.find(id)
def role_on(aircraft) = acting_user&.role_for(aircraft)
def owner_of?(aircraft) = role_on(aircraft).in?(%w[admin owner])
# What the person it's acting for can do on the aircraft, as in the app (Role).
def can?(permission, aircraft) = acting_user&.can?(permission, aircraft) || false
def not_permitted(permission)
render_error(:forbidden, "not_permitted", "This needs the \"#{Permission.label(permission)}\" permission on the aircraft.")
end
# ?limit= (1–200, default 50), ?after=<id> to continue, ?updated_since=<ISO time>.
def paginate(scope)
@@ -27,7 +27,7 @@ module Api
# POST /aircraft/:aircraft_id/draft_batches
def create
@aircraft = find_aircraft
return render_error(:forbidden, "owners_only", "Draft entries are for the aircraft's owners (act for an owner).") unless owner_of?(@aircraft)
return not_permitted(:write_logbook) unless can?(:write_logbook, @aircraft)
input = params.require(:draft_batch)
items = Array(input[:items]).map { _1.permit(:log, :text, :external_ref, resolves_squawks: []) }
@@ -54,7 +54,7 @@ module Api
# DELETE /draft_batches/:id: withdraw it while nothing in it is signed.
def destroy
batch = find_batch
return render_error(:forbidden, "owners_only", "Only the aircraft's owners can withdraw a draft.") unless owner_of?(batch.aircraft)
return not_permitted(:write_logbook) unless can?(:write_logbook, batch.aircraft)
unless batch.awaiting? && batch.entries.none?(&:signed?)
return render_error(:conflict, "signed", "Part of this draft is signed (or it's no longer awaiting signature); correct it in the app instead.")
end
+4 -3
View File
@@ -31,6 +31,7 @@ module Api
# POST /aircraft/:aircraft_id/squawks
def create
aircraft = find_aircraft
return not_permitted(:report_squawks) unless can?(:report_squawks, aircraft)
squawk = aircraft.squawks.new(create_params.merge(reported_by: acting_user, resolved: false))
squawk.component_id = nil unless aircraft.components.exists?(id: squawk.component_id)
squawk.save!
@@ -39,13 +40,13 @@ module Api
end
# PATCH /squawks/:id: external_ref by anyone who may write; the rest
# (issue, priority, component, notes) by the aircraft's owners, as in the app.
# (issue, priority, component, notes) with "manage squawks", as in the app.
def update
squawk = find_squawk
return render_error(:unprocessable_entity, "resolved", "A resolved squawk can't be changed.") if squawk.resolved?
attrs = params.require(:squawk).permit(:external_ref, :issue_reported, :priority, :component_id, :notes)
if (attrs.keys - %w[external_ref]).any? && !owner_of?(squawk.aircraft)
return render_error(:forbidden, "owners_only", "Only the aircraft's owners can change a squawk's details.")
if (attrs.keys - %w[external_ref]).any? && !can?(:manage_squawks, squawk.aircraft)
return not_permitted(:manage_squawks)
end
attrs[:component_id] = nil if attrs.key?(:component_id) && !squawk.aircraft.components.exists?(id: attrs[:component_id])
squawk.update!(attrs)
+1 -1
View File
@@ -1,6 +1,6 @@
class ComponentsController < ApplicationController
include AircraftScoped
before_action :require_owner!, except: %i[index show]
requires_permission :manage_components, except: %i[index show]
before_action :set_component, only: %i[show edit update destroy reset_service]
def index
+53 -15
View File
@@ -1,16 +1,38 @@
# Scopes a controller to one aircraft the current user can access and exposes
# role helpers. Unknown and inaccessible aircraft both 404 (enumeration-safe).
# Scopes a controller to one aircraft the current user can access, and checks
# what their role there allows (Role, Permission). Unknown and inaccessible
# aircraft both 404 (enumeration-safe). Administrators can do everything.
#
# Access matrix (mirrors the original):
# admin – everything
# owner – everything on their aircraft
# pilot – view all; update hours; create squawks, notes, oil/fuel, flight logs
# Each controller says which permission its actions need:
#
# requires_permission :manage_components, except: %i[index show]
# requires_permission :report_squawks, only: %i[new create]
# checks_permission_itself only: %i[edit update] # decided in the controller
#
# Looking needs no permission. A request that changes something (anything but
# GET/HEAD) with no permission declared for its action is refused, so nothing
# is left open by mistake; in development and tests it raises instead.
module AircraftScoped
extend ActiveSupport::Concern
SELF_CHECKED = "(checked by the controller)".freeze
class MissingPermission < StandardError; end
included do
class_attribute :permission_rules, instance_accessor: false, default: []
before_action :set_aircraft
helper_method :current_role, :owner?, :can_write?
before_action :authorize_permission!
helper_method :current_role, :can?, :owner?
end
class_methods do
def requires_permission(permission, only: nil, except: nil)
self.permission_rules += [ [ permission.to_s, only && Array(only).map(&:to_s), except && Array(except).map(&:to_s) ] ]
end
def checks_permission_itself(only:)
requires_permission(SELF_CHECKED, only: only)
end
end
private
@@ -21,18 +43,34 @@ module AircraftScoped
@aircraft = current_user.accessible_aircraft.find(aircraft_param)
end
# Their Role here (nil for an administrator without one).
def current_role
@current_role ||= current_user.role_for(@aircraft)
return @current_role if defined?(@current_role)
@current_role = current_user.role_for(@aircraft)
end
# Owner-level write access (admins included).
def owner? = current_role.in?(%w[admin owner])
alias_method :can_write?, :owner?
def can?(permission) = current_user.admin? || current_role&.can?(permission) || false
def require_owner!
return if owner?
redirect_back fallback_location: aircraft_path(@aircraft),
alert: t("flash.common.only_owners_can_do")
# The Owner role (or an administrator): everything.
def owner? = current_user.admin? || current_role&.owner? || false
def authorize_permission!
rules = self.class.permission_rules.select do |_, only, except|
(only.nil? || only.include?(action_name)) && (except.nil? || except.exclude?(action_name))
end
if rules.empty?
return if request.get? || request.head?
raise MissingPermission, "#{self.class.name}##{action_name} changes data without declaring a permission" if Rails.env.local?
return permission_denied
end
permission_denied unless rules.all? { |permission, *| permission == SELF_CHECKED || can?(permission) }
end
def permission_denied
respond_to do |format|
format.html { redirect_back fallback_location: aircraft_path(@aircraft), alert: t("flash.common.not_allowed") }
format.any { head :forbidden }
end
end
# Returns id only if it belongs to the given (aircraft-scoped) relation; else nil.
@@ -1,6 +1,7 @@
class ConsumableRecordsController < ApplicationController
include AircraftScoped
before_action :require_owner!, only: %i[edit update destroy]
requires_permission :record_consumables, only: %i[new create]
requires_permission :manage_consumables, only: %i[edit update destroy]
before_action :set_record, only: %i[edit update destroy]
RECORDS_PER_PAGE = 50
@@ -1,6 +1,6 @@
class DocumentCollectionsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_documents
before_action :set_collection, only: %i[edit update destroy]
def new
+1 -1
View File
@@ -1,6 +1,6 @@
class DocumentsController < ApplicationController
include AircraftScoped
before_action :require_owner!, except: %i[index show]
requires_permission :manage_documents, except: %i[index show]
before_action :set_document, only: %i[show edit update destroy]
def index
@@ -3,6 +3,7 @@
# who they are again (password, or single sign-on just now), and confirms.
class EntrySignaturesController < ApplicationController
include AircraftScoped
requires_permission :sign_logbook
include EntrySigning
before_action :set_entry
+1 -1
View File
@@ -2,7 +2,7 @@
class FlightImportsController < ApplicationController
include AircraftScoped
include StoredUpload
before_action :require_owner!
requires_permission :import_flights
def new; end
+7 -2
View File
@@ -1,6 +1,8 @@
class FlightLogsController < ApplicationController
include AircraftScoped
before_action :require_owner!, only: :destroy
requires_permission :log_flights, only: %i[new create]
requires_permission :delete_flights, only: :destroy
checks_permission_itself only: %i[edit update attach_engine_data remove_engine_data]
before_action :set_flight_log, only: %i[show edit update engine_data_series attach_engine_data remove_engine_data]
before_action :require_flight_editor!, only: %i[edit update]
helper_method :can_edit_flight?
@@ -126,7 +128,10 @@ class FlightLogsController < ApplicationController
private
def can_edit_flight?(flight) = flight.editable_by?(current_user, role: current_role)
# Any flight with "correct any flight"; the ones they logged with "correct own flights".
def can_edit_flight?(flight)
can?(:edit_any_flight) || (can?(:edit_own_flights) && flight.user_id.present? && flight.user_id == current_user.id)
end
def require_flight_editor!
return if can_edit_flight?(@flight_log)
@@ -1,6 +1,6 @@
class InspectionRecordsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_inspections
before_action :set_record, only: %i[edit update destroy]
def new
@@ -1,7 +1,7 @@
class InspectionTypesController < ApplicationController
include AircraftScoped
include Applicability
before_action :require_owner!
requires_permission :manage_inspections
before_action :set_type, only: %i[edit update destroy]
def new
+1 -1
View File
@@ -2,7 +2,7 @@
# the loading calculator.
class LoadingSetupsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_weight_balance
def edit
@setup = @aircraft.loading_setup
@@ -1,6 +1,6 @@
class LogbookEntriesController < ApplicationController
include AircraftScoped
before_action :require_owner!, except: %i[index show]
requires_permission :write_logbook, except: %i[index show]
before_action :set_entry, only: %i[show edit update destroy verify]
before_action :require_unsigned, only: %i[edit update destroy]
@@ -3,7 +3,7 @@
# entries in the background (LogbookTranscriptionJob).
class LogbookImportsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :import_records
def new
@collections = @aircraft.document_collections.ordered
+1 -1
View File
@@ -1,6 +1,6 @@
class MajorRecordsController < ApplicationController
include AircraftScoped
before_action :require_owner!, except: %i[index show]
requires_permission :manage_major_records, except: %i[index show]
before_action :set_record, only: %i[show edit update destroy]
def index
+2 -1
View File
@@ -1,6 +1,7 @@
class NotesController < ApplicationController
include AircraftScoped
before_action :require_owner!, only: %i[edit update destroy]
requires_permission :write_notes, only: %i[new create preview]
requires_permission :manage_notes, only: %i[edit update destroy]
before_action :set_note, only: %i[edit update destroy]
def index
+2 -1
View File
@@ -1,6 +1,7 @@
class OilAnalysesController < ApplicationController
include AircraftScoped
before_action :require_owner!, only: %i[edit update destroy]
requires_permission :record_oil_analyses, only: %i[new create import]
requires_permission :manage_oil_analyses, only: %i[edit update destroy]
before_action :set_analysis, only: %i[show edit update destroy]
COMPARE_SAMPLES = 6 # columns in the trend table, like the lab report's history
@@ -1,7 +1,7 @@
# Every change to the aircraft's maintenance records (AC 120-78B 3.2.2).
class RecordVersionsController < ApplicationController
include AircraftScoped
before_action :require_owner!, only: :restore
requires_permission :restore_history, only: :restore
SHARED = { "AirworthinessDirective" => AirworthinessDirective, "InspectionType" => InspectionType }.freeze
@@ -1,7 +1,7 @@
# Download every record of an aircraft in one ZIP (owners).
class RecordsPackagesController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :export_data
def show
package = RecordsPackage.new(@aircraft, source: request.host)
+1 -1
View File
@@ -1,6 +1,6 @@
class ShareTokensController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_sharing
def create
token = @aircraft.share_tokens.new(params.require(:share_token).permit(:label, :privilege, :expires_at))
@@ -1,7 +1,7 @@
# An owner asks someone outside the aircraft (a mechanic) to sign an entry.
class SigningInvitationsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :write_logbook
before_action :set_entry
rate_limit to: 10, within: 1.hour, only: :create, with: -> { redirect_back fallback_location: root_path, alert: t("flash.signing_invitations.too_many_invitations_try") }
+3 -1
View File
@@ -2,7 +2,9 @@ class SquawksController < ApplicationController
include AircraftScoped
# Pilots may create squawks and defer inoperative items (91.213(d) lets the
# pilot decide); editing and resolving need an owner.
before_action :require_owner!, except: %i[index new create deferral defer]
requires_permission :report_squawks, only: %i[new create]
requires_permission :defer_squawks, only: %i[deferral defer]
requires_permission :manage_squawks, except: %i[index new create deferral defer]
before_action :set_squawk, only: %i[edit update destroy resolution resolve reopen deferral defer undefer]
def index
@@ -1,6 +1,6 @@
class StandardInspectionsController < ApplicationController
include AircraftScoped
before_action :require_owner!
requires_permission :manage_inspections
def new; end
@@ -2,7 +2,7 @@
# keep the records and the loading setup).
class WeightBalanceRecordsController < ApplicationController
include AircraftScoped
before_action :require_owner!, except: :index
requires_permission :manage_weight_balance, except: :index
before_action :set_record, only: %i[edit update destroy]
def index