Module: Rolypoly::RoleDSL::InstanceMethods
- Extended by:
- Forwardable
- Defined in:
- lib/rolypoly/role_dsl.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rolypoly/role_dsl.rb', line 15 def self.included(base) unless base.method_defined?(:current_user_roles) base.send(:define_method, :current_user_roles) do [] end end unless base.method_defined?(:rolypoly_resource_map) base.send(:define_method, :rolypoly_resource_map) do {} end end end |
Instance Method Details
#allow?(action, options = {}) ⇒ Boolean
32 33 34 |
# File 'lib/rolypoly/role_dsl.rb', line 32 def allow?(action, = {}) rolypoly_gatekeepers.allow?(current_user_roles, action, rolypoly_resource_map.merge()) end |
#allowed_roles(action, options = {}) ⇒ Object
36 37 38 |
# File 'lib/rolypoly/role_dsl.rb', line 36 def allowed_roles(action, = {}) rolypoly_gatekeepers.allowed_roles(current_user_roles, action, rolypoly_resource_map.merge()) end |