Class: AuditLogEntry

Inherits:
ApplicationRecord
  • Object
show all
Includes:
PgSearch::Model, Ransackable
Defined in:
lib/generators/ruby_cms/templates/models/audit_log_entry.rb

Constant Summary collapse

BUCKETS =
%w[content users system security].freeze

Instance Method Summary collapse

Instance Method Details

#bucketObject



40
41
42
43
44
45
46
47
48
# File 'lib/generators/ruby_cms/templates/models/audit_log_entry.rb', line 40

def bucket
  case action.to_s
  when /\A(content_block|media|form|redirect)/ then "content"
  when /\A(user|permission|token|login)/       then "users"
  when /\A(system|job|backup|deploy|cache|sitemap)/ then "system"
  when /(failed|webhook|integration|settings)/ then "security"
  else                                              "system"
  end
end

#severityObject



50
51
52
53
54
55
# File 'lib/generators/ruby_cms/templates/models/audit_log_entry.rb', line 50

def severity
  return :danger  if action.to_s.match?(/(failed|delete)/)
  return :success if action.to_s.match?(/(publish|complete|success)/)

  :default
end