Sha256: 9715f9e87ca61c44488a71be7353808cdf8bc2681c72119874d969aef3c88862
Contents?: true
Size: 769 Bytes
Versions: 12
Compression:
Stored size: 769 Bytes
Contents
#module EnjuPurchaseRequest class Ability include CanCan::Ability def initialize(user, ip_address = nil) case user.try(:role).try(:name) when 'Administrator' can [:destroy, :delete], Bookstore do |bookstore| bookstore.order_lists.empty? and bookstore.items.empty? end can :manage, [ Order, OrderList, PurchaseRequest ] when 'Librarian' can :manage, [ Order, OrderList, PurchaseRequest ] when 'User' can [:index, :create], PurchaseRequest can [:show, :update, :destroy, :delete], PurchaseRequest do |purchase_request| purchase_request.user == user end end end end #end
Version data entries
12 entries across 12 versions & 1 rubygems