Class: Homeland::Wiki::Ability
- Inherits:
-
Object
- Object
- Homeland::Wiki::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/homeland/wiki/ability.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(u) ⇒ Ability
constructor
A new instance of Ability.
Constructor Details
#initialize(u) ⇒ Ability
Returns a new instance of Ability.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/homeland/wiki/ability.rb', line 7 def initialize(u) @user = u if @user.blank? roles_for_anonymous elsif @user.roles?(:admin) can :manage, Page elsif @user.roles?(:wiki_editor) roles_for_wiki_editor else roles_for_anonymous end end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'app/models/homeland/wiki/ability.rb', line 5 def user @user end |