Class: Virgo::Ability
- Inherits:
-
Object
- Object
- Virgo::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/virgo/ability.rb
Instance Method Summary collapse
- #admin ⇒ Object
- #anonymous ⇒ Object
- #contributor ⇒ Object
- #editor ⇒ Object
-
#initialize(user) ⇒ Ability
constructor
A new instance of Ability.
- #normal ⇒ Object
- #superuser ⇒ Object
Constructor Details
Instance Method Details
#admin ⇒ Object
51 52 53 |
# File 'app/models/virgo/ability.rb', line 51 def admin can :manage, :all end |
#anonymous ⇒ Object
13 14 15 16 17 |
# File 'app/models/virgo/ability.rb', line 13 def anonymous can :read, Post do |post| post.published? && post.live end end |
#contributor ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/models/virgo/ability.rb', line 31 def contributor can :manage, Virgo::Post do |post| post. == @user end can :manage, Virgo::Slideshow do || . == @user end can :manage, Virgo::Slide do || can?(:manage, .) end can :read, Virgo::Post cannot :manage, Virgo::User cannot :manage, Virgo::Column cannot :manage, Virgo::Site end |
#editor ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/models/virgo/ability.rb', line 23 def editor can :manage, :all can :manage, Virgo::User do |u| u == @user end cannot :index, Virgo::User end |
#normal ⇒ Object
19 20 21 |
# File 'app/models/virgo/ability.rb', line 19 def normal anonymous end |
#superuser ⇒ Object
55 56 57 |
# File 'app/models/virgo/ability.rb', line 55 def superuser can :manage, :all end |