Sha256: bcd6a4a2ebd06133be6ef18479cc666f05f4d0ef8e2a38d187babc4cbb2eb397
Contents?: true
Size: 523 Bytes
Versions: 16
Compression:
Stored size: 523 Bytes
Contents
class Ability include CanCan::Ability def initialize(user) case user.try(:role).try(:name) when 'Administrator' can :manage, [ Order, OrderList, PurchaseRequest ] when 'Librarian' can :manage, [ Order, OrderList, PurchaseRequest ] when 'User' can [:index, :create], PurchaseRequest can [:show, :update, :destroy], PurchaseRequest do |purchase_request| purchase_request.user == user end end end end
Version data entries
16 entries across 16 versions & 1 rubygems