Module: AuthAssistant::Helpers::Roles
- Defined in:
- lib/auth_assistant/helpers/roles.rb
Class Method Summary collapse
Instance Method Summary collapse
- #not_roles_area(*user_roles, options, &block) ⇒ Object
- #not_roles_block(*user_roles, &block) ⇒ Object
- #role?(*user_roles) ⇒ Boolean
- #roles_area(*user_roles, options, &block) ⇒ Object
- #roles_block(*user_roles, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
32 33 34 |
# File 'lib/auth_assistant/helpers/roles.rb', line 32 def self.included(base) base.helper_method :roles_block, :not_roles_block, :roles_area, :not_roles_area, :role? end |
Instance Method Details
#not_roles_area(*user_roles, options, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/auth_assistant/helpers/roles.rb', line 12 def not_roles_area(*user_roles, , &block) ||= {} not_roles_block user_roles do clazz = [:class] || 'special' do_roles_area(clazz, &block) end end |
#not_roles_block(*user_roles, &block) ⇒ Object
24 25 26 |
# File 'lib/auth_assistant/helpers/roles.rb', line 24 def not_roles_block(*user_roles, &block) with_output_buffer(&block) if !role?(user_roles) end |
#role?(*user_roles) ⇒ Boolean
28 29 30 |
# File 'lib/auth_assistant/helpers/roles.rb', line 28 def role?(*user_roles) devise_role?(user_roles) || cancan_role?(user_roles) end |
#roles_area(*user_roles, options, &block) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/auth_assistant/helpers/roles.rb', line 4 def roles_area(*user_roles, , &block) ||= {} roles_block user_roles do clazz = [:class] || 'special' do_roles_area(clazz, &block) end end |
#roles_block(*user_roles, &block) ⇒ Object
20 21 22 |
# File 'lib/auth_assistant/helpers/roles.rb', line 20 def roles_block(*user_roles, &block) with_output_buffer(&block) if role?(user_roles) end |