Class: Accessly::Permission::Revoke
- Defined in:
- lib/accessly/permission/revoke.rb
Instance Method Summary collapse
-
#initialize(actor) ⇒ Revoke
constructor
Create an instance of Accessly::Permission::Revoke Pass in an ActiveRecord::Base for actor.
-
#revoke!(action_id, object_type, object_id = nil) ⇒ nil
Revoke a permission for an actor.
Methods inherited from Base
Constructor Details
#initialize(actor) ⇒ Revoke
Create an instance of Accessly::Permission::Revoke Pass in an ActiveRecord::Base for actor
9 10 11 12 13 14 15 16 17 |
# File 'lib/accessly/permission/revoke.rb', line 9 def initialize(actor) super(actor) @actor = case actor when ActiveRecord::Base actor else raise Accessly::RevokeError.new("Actor is not an ActiveRecord::Base object") end end |
Instance Method Details
#revoke!(action_id, object_type) ⇒ nil #revoke!(action_id, object_type, object_id) ⇒ nil
Revoke a permission for an actor.
51 52 53 54 55 56 57 |
# File 'lib/accessly/permission/revoke.rb', line 51 def revoke!(action_id, object_type, object_id = nil) if object_id.nil? general_action_revoke(action_id, object_type) else object_action_revoke(action_id, object_type, object_id) end end |