Module: Rabarber::Core::Access
- Included in:
- Permissions
- Defined in:
- lib/rabarber/core/access.rb
Instance Method Summary collapse
- #access_granted?(roleable, action, controller_instance) ⇒ Boolean
- #action_accessible?(roleable, action, controller_instance) ⇒ Boolean
- #controller_accessible?(roleable, controller_instance) ⇒ Boolean
Instance Method Details
#access_granted?(roleable, action, controller_instance) ⇒ Boolean
6 7 8 |
# File 'lib/rabarber/core/access.rb', line 6 def access_granted?(roleable, action, controller_instance) controller_accessible?(roleable, controller_instance) || action_accessible?(roleable, action, controller_instance) end |
#action_accessible?(roleable, action, controller_instance) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/rabarber/core/access.rb', line 16 def action_accessible?(roleable, action, controller_instance) action_rules[controller_instance.class].any? do |rule| rule.action == action && rule.verify_access(roleable, controller_instance) end end |
#controller_accessible?(roleable, controller_instance) ⇒ Boolean
10 11 12 13 14 |
# File 'lib/rabarber/core/access.rb', line 10 def controller_accessible?(roleable, controller_instance) controller_rules.any? do |rule_controller, rule| controller_instance.is_a?(rule_controller) && rule.verify_access(roleable, controller_instance) end end |