Class: Ability
- Inherits:
-
Object
- Object
- Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/ability.rb
Instance Method Summary collapse
-
#initialize(admin_user) ⇒ Ability
constructor
A new instance of Ability.
Constructor Details
#initialize(admin_user) ⇒ Ability
Returns a new instance of Ability.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/ability.rb', line 4 def initialize(admin_user) admin_user ||= SimpleUser::AdminUser.new puts "ADMIN USER: #{admin_user.inspect}" if admin_user.has_role? :admin can :manage, :all else if admin_user.has_role? :role_manager can :manage, SimpleUser::AdminUser can :manage, Role elsif admin_user.has_role? :admin_user_manager can :manage, SimpleUser::AdminUser end if admin_user.has_role? :user_manager can :manage, SimpleUser::User end end end |