Module: Conjur::Audit::Tableizer
- Included in:
- WebServer::AuditStream
- Defined in:
- lib/conjur/audit/tableizer.rb
Class Method Summary collapse
- .append_features(base) ⇒ Object
-
.tableize(event) ⇒ Object
Output a standardized event suitable for table display.
Class Method Details
.append_features(base) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/conjur/audit/tableizer.rb', line 26 def append_features base base.class_eval do def tableize e Conjur::Audit::Tableizer.tableize e end def self.humanize e Conjur::Audit::Tableizer.tableize e end end end |
.tableize(event) ⇒ Object
Output a standardized event suitable for table display.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/conjur/audit/tableizer.rb', line 6 def tableize event e = event.symbolize_keys # hack: sometimes resource is a hash. We don't want that! if e[:resource] && e[:resource].kind_of?(Hash) e[:resource] = e[:resource]['id'] end formatter = INFO_FORMATS["#{e[:asset]}:#{e[:action]}"] info = if formatter formatter.call(e) else { } end result = {} result[:actor] = e[:conjur_role] || e[:conjur_user] result.merge! info event['table'] = result end |