Module: AuthAssistant::RoleStrategy::Shared

Defined in:
lib/auth_assistant/role_strategies/shared.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#abilityObject

Returns the value of attribute ability.



4
5
6
# File 'lib/auth_assistant/role_strategies/shared.rb', line 4

def ability
  @ability
end

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/auth_assistant/role_strategies/shared.rb', line 6

def admin?
  role? 'admin'
end

#available_rolesObject



20
21
22
# File 'lib/auth_assistant/role_strategies/shared.rb', line 20

def available_roles
  AuthAssistant::Model.available_roles
end

#has(ability) ⇒ Object



10
11
12
# File 'lib/auth_assistant/role_strategies/shared.rb', line 10

def has(ability)
  @ability ||= ability
end

#owns(clazz) ⇒ Object



14
15
16
17
18
# File 'lib/auth_assistant/role_strategies/shared.rb', line 14

def owns(clazz)
  return if !ability
  base ||= RolePermit::Base.new(ability)
  base.owns(self, clazz)
end