Sha256: bc4a924c19f18f23922244470e38c93f2a46e3a7694cd5fb98510bbdfd6c5e1f

Contents?: true

Size: 502 Bytes

Versions: 13

Compression:

Stored size: 502 Bytes

Contents

class Ability
  include CanCan::Ability

  def initialize(user)
    can :read, :all
    return cannot :read, User unless user
    user ||= User.new
    case user.role_id
      when Role::SUPER
        can :manage, :all
      when Role::ADMIN
        can :manage, :all
      when Role::USER
        can :manage, Gallery, :user_id => user.id
        can :manage, Blog, :user_id => user.id
        can :edit, Profile, :user_id => user.id
        cannot :read, User
    end
    can :read, :all

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wheels-0.0.17 app/models/ability.rb
wheels-0.0.16 app/models/ability.rb
wheels-0.0.15 app/models/ability.rb
wheels-0.0.14 app/models/ability.rb
wheels-0.0.13 app/models/ability.rb
wheels-0.0.11 app/models/ability.rb
wheels-0.0.10 app/models/ability.rb
wheels-0.0.9 app/models/ability.rb
wheels-0.0.8 app/models/ability.rb
wheels-0.0.6 app/models/ability.rb
wheels-0.0.5 app/models/ability.rb
wheels-0.0.4 app/models/ability.rb
wheels-0.0.3 app/models/ability.rb