Class: Authoritah::Controller::PermissionSet
- Inherits:
-
Object
- Object
- Authoritah::Controller::PermissionSet
- Defined in:
- lib/authoritah.rb
Instance Method Summary collapse
- #<<(permission_hash) ⇒ Object
- #first ⇒ Object
- #permissions ⇒ Object
- #permits?(controller, action) ⇒ Boolean
- #size ⇒ Object
Instance Method Details
#<<(permission_hash) ⇒ Object
82 83 84 85 |
# File 'lib/authoritah.rb', line 82 def <<() [:actions] = [:all] unless [:actions] << end |
#first ⇒ Object
91 92 93 |
# File 'lib/authoritah.rb', line 91 def first .first end |
#permissions ⇒ Object
109 110 111 |
# File 'lib/authoritah.rb', line 109 def @permissions ||= [] end |
#permits?(controller, action) ⇒ Boolean
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/authoritah.rb', line 95 def permits?(controller, action) permitted, on_reject_action = apply_rule_chain(:permit, controller, action) if permitted return true else if on_reject_action.is_a?(Proc) controller.instance_eval(&on_reject_action) else controller.send(on_reject_action) end return false end end |
#size ⇒ Object
87 88 89 |
# File 'lib/authoritah.rb', line 87 def size .size end |