Class: PgSqlTriggers::AuditLogsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pg_sql_triggers/audit_logs_controller.rb

Constant Summary collapse

TEXT_SEARCH_SQL =
[
  "trigger_name ILIKE :t",
  "operation ILIKE :t",
  "COALESCE(reason, '') ILIKE :t",
  "COALESCE(error_message, '') ILIKE :t"
].join(" OR ").freeze
CSV_HEADERS =
[
  "ID", "Trigger Name", "Operation", "Status", "Environment",
  "Actor Type", "Actor ID", "Reason", "Error Message",
  "Created At"
].freeze

Instance Method Summary collapse

Methods included from PermissionsHelper

#can?, #can_apply_triggers?, #can_drop_triggers?, #can_enable_disable_triggers?, #can_execute_sql_operations?, #can_generate_triggers?, #can_view_triggers?

Methods included from ErrorHandling

#format_error_for_flash, #handle_kill_switch_error, #handle_standard_error, #rescue_pg_sql_triggers_error

Methods included from PermissionChecking

#can_apply_triggers?, #can_drop_triggers?, #can_enable_disable_triggers?, #can_execute_sql_operations?, #can_generate_triggers?, #can_view_triggers?, #check_admin_permission, #check_operator_permission, #check_viewer_permission, #current_actor, #current_user_id, #current_user_type

Methods included from KillSwitchProtection

#check_kill_switch, #current_environment, #expected_confirmation_text, #kill_switch_active?, #require_kill_switch_override

Instance Method Details

#indexObject

GET /audit_logs Display audit log entries with filtering and sorting



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/pg_sql_triggers/audit_logs_controller.rb', line 22

def index
  scope = apply_filters(PgSqlTriggers::AuditLog.all)
  @audit_logs = scope.order(created_at: sort_direction)

  paginate_audit_logs
  load_filter_options

  respond_to do |format|
    format.html
    format.csv { send_csv_response(scope) }
  end
end