Sha256: 3f3cbe0a9bacd47d01fc9ccb764d66d5a553668864afce1c173f9b2afcc79a22

Contents?: true

Size: 1.27 KB

Versions: 14

Compression:

Stored size: 1.27 KB

Contents

class Ability
  include CanCan::Ability

  def initialize(user)
    case user.try(:role).try(:name)
    when 'Administrator'
      can :manage, Classification
      can :manage, ClassificationType
      can :manage, Subject
      can :manage, SubjectHasClassification
      can :manage, SubjectHeadingType
      can :manage, SubjectHeadingTypeHasSubject
      can :manage, SubjectType
      can :manage, WorkHasSubject
      can :manage, Manifestation
    when 'Librarian'
      can :read, Classification
      can :read, ClassificationType
      can :read, Subject
      can :manage, SubjectHasClassification
      can :read, SubjectHeadingType
      can :read, SubjectHeadingTypeHasSubject
      can :read, SubjectType
      can :manage, WorkHasSubject
      can :read, Manifestation
    when 'User'
      can :read, Classification
      can :read, ClassificationType
      can :read, Subject
      can :read, SubjectHasClassification
      can :read, SubjectHeadingType
      can :read, WorkHasSubject
      can :read, Manifestation
    else
      can :read, Classification
      can :read, ClassificationType
      can :read, Subject
      can :read, SubjectHasClassification
      can :read, SubjectHeadingType
      can :read, WorkHasSubject
      can :read, Manifestation
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
enju_subject-0.1.0.pre5 spec/dummy/app/models/ability.rb
enju_subject-0.1.0.pre4 spec/dummy/app/models/ability.rb
enju_subject-0.1.0.pre3 spec/dummy/app/models/ability.rb
enju_subject-0.1.0.pre2 spec/dummy/app/models/ability.rb
enju_subject-0.1.0.pre spec/dummy/app/models/ability.rb
enju_subject-0.0.18 spec/dummy/app/models/ability.rb
enju_subject-0.0.17 spec/dummy/app/models/ability.rb
enju_subject-0.0.16 spec/dummy/app/models/ability.rb
enju_subject-0.0.15 spec/dummy/app/models/ability.rb
enju_subject-0.0.14 spec/dummy/app/models/ability.rb
enju_subject-0.0.13 spec/dummy/app/models/ability.rb
enju_subject-0.0.12 spec/dummy/app/models/ability.rb
enju_subject-0.0.10 spec/dummy/app/models/ability.rb
enju_subject-0.0.9 spec/dummy/app/models/ability.rb