Sha256: efc4be05facdbffa007c99a20355b713e7b8747282cc1c819a4a3d00b44bff78

Contents?: true

Size: 426 Bytes

Versions: 15

Compression:

Stored size: 426 Bytes

Contents

class Ability
  include CanCan::Ability

  def initialize(user)
    case user.try(:role).try(:name)
    when 'Administrator'
      can [:read, :create, :update], Manifestation
    when 'Librarian'
      can [:read, :create, :update], Manifestation
    when 'User'
      can :read, Manifestation do |manifestation|
        manifestation.required_role_id <= 2
      end
    else
      can :read, Manifestation
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
enju_oai-0.2.0.beta.1 spec/dummy/app/models/ability.rb
enju_oai-0.1.1 spec/dummy/app/models/ability.rb
enju_oai-0.1.0 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre20 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre19 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre18 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre17 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre16 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre15 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre14 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre13 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre12 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre11 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre10 spec/dummy/app/models/ability.rb
enju_oai-0.1.0.pre9 spec/dummy/app/models/ability.rb