Class: Clickwrap::ReceiptAccess
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Clickwrap::ReceiptAccess
- Defined in:
- lib/clickwrap/models/receipt_access.rb
Overview
A record of who read a receipt, what the export revealed, and why.
Unredacted request evidence needs host authorization plus a human-readable reason, and asking for it appends a row here. The table is plain and queryable on purpose: an access log nobody can read is not much of a control.
Constant Summary collapse
- CHANNELS =
%w[api web export task].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.record!(event:, requested_by:, because:, included_fields:, access_channel: "api") ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/clickwrap/models/receipt_access.rb', line 26 def self.record!(event:, requested_by:, because:, included_fields:, access_channel: "api") create!( event_id: event.is_a?(String) ? event : event.id, requested_by_reference: Reference.actor(requested_by), reason: because, included_fields: included_fields, access_channel: access_channel, accessed_at: Clickwrap.now, created_at: Clickwrap.now ) end |
Instance Method Details
#to_s ⇒ Object
38 |
# File 'lib/clickwrap/models/receipt_access.rb', line 38 def to_s = "access to #{event_id} by #{requested_by_reference}" |