Module: Rolypoly::ControllerRoleDSL::InstanceMethods
- Defined in:
- lib/rolypoly/controller_role_dsl.rb
Instance Method Summary collapse
- #allow?(options = {}) ⇒ Boolean
- #current_gatekeepers ⇒ Object
- #current_roles ⇒ Object
- #failed_role_check! ⇒ Object
- #public? ⇒ Boolean
- #rolypoly_check_role_access! ⇒ Object
Instance Method Details
#allow?(options = {}) ⇒ Boolean
49 50 51 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 49 def allow?( = {}) rolypoly_gatekeepers.allow?(current_roles, action_name, rolypoly_resource_map.merge()) end |
#current_gatekeepers ⇒ Object
43 44 45 46 47 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 43 def current_gatekeepers rolypoly_gatekeepers.select { |gatekeeper| gatekeeper.action? action_name } end |
#current_roles ⇒ Object
33 34 35 36 37 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 33 def current_roles return [] if rolypoly_gatekeepers.empty? allowed_roles(action_name) end |
#failed_role_check! ⇒ Object
29 30 31 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 29 def failed_role_check! raise Rolypoly::FailedRoleCheckError end |
#public? ⇒ Boolean
39 40 41 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 39 def public? super(action_name) end |
#rolypoly_check_role_access! ⇒ Object
25 26 27 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 25 def rolypoly_check_role_access! failed_role_check! unless rolypoly_role_access? end |