Class: ActingFor::Delegation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ActingFor::Delegation
- Defined in:
- app/models/acting_for/delegation.rb
Constant Summary collapse
- IMMUTABLE_ATTRIBUTES =
%w[ agent_id principal_type principal_id action resource_type resource_id constraints effect expires_at revoked_at ].freeze
- CONSTRAINT_KEYS =
%w[field operator value].freeze
Instance Method Summary collapse
Instance Method Details
#revoke! ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/models/acting_for/delegation.rb', line 19 def revoke! raise ActiveRecord::RecordNotSaved.new("Cannot revoke an unsaved delegation", self) unless persisted? time = ActingFor.current_time self.class.where(id: id, revoked_at: nil).update_all(revoked_at: time, updated_at: time) reload end |