mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
AC 120-78B chapter 3:
- Every change to logbook entries, sub-components, signatures, inspection
records, AD compliance, major records, W&B, components, squawks and
documents is kept as a RecordVersion (who, IP, when, field changes),
hash-chained per aircraft; versions can't be edited or deleted. Shown on
each logbook entry and in Activity -> Record history
- Nightly job: SQLite online-backup copy to storage/backups, verified
(integrity_check + record counts), pruned to the configured number; then
an integrity check of the history chains and every signature's seal and
fingerprint. Results on Admin -> About ("Back up and check now"); admins
are emailed on failure
- Software versions recorded (first/last seen) on Admin -> About
- Records package (Access & Sharing): logbook entries PDF with signatures,
signatures.csv, record-history.csv, self-contained status report HTML,
the .sam.zip, and a README, for the FAA/NTSB or a buyer
- Legacy (paper) records: documents can be marked as legacy records;
aircraft have an "electronic records since" date (status report, package)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
869 B
Ruby
30 lines
869 B
Ruby
class ApplicationController < ActionController::Base
|
|
default_form_builder AppFormBuilder
|
|
include Authentication
|
|
allow_browser versions: :modern
|
|
|
|
prepend_before_action :redirect_to_setup
|
|
before_action { Current.ip_address = request.remote_ip } # for record history
|
|
helper_method :current_user
|
|
|
|
rescue_from ActiveRecord::RecordNotFound do
|
|
respond_to do |format|
|
|
format.html { render "errors/not_found", status: :not_found, layout: (authenticated? ? "application" : "public") }
|
|
format.any { head :not_found }
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def current_user = Current.user
|
|
|
|
# First run: no users yet → create the initial admin.
|
|
def redirect_to_setup
|
|
redirect_to new_setup_path if !User.exists? && !is_a?(SetupController)
|
|
end
|
|
|
|
def require_admin!
|
|
redirect_to root_path, alert: "Admins only." unless current_user&.admin?
|
|
end
|
|
end
|