Sha256: f82fc1668490652a4acfe77cbd531958022a31e3759bbd6be8e70b3caa904c4e
Contents?: true
Size: 944 Bytes
Versions: 20
Compression:
Stored size: 944 Bytes
Contents
module EnjuMessage class Ability include CanCan::Ability def initialize(user, ip_address = nil) case user.try(:role).try(:name) when 'Administrator' can :manage, Message can [:read, :update, :destroy, :delete], MessageRequest can [:read, :update], MessageTemplate when 'Librarian' can [:index, :create], Message can [:update], Message do |message| message.sender == user end can [:show, :destroy, :delete], Message do |message| message.receiver == user end can [:read, :update, :destroy, :delete], MessageRequest can :read, MessageTemplate when 'User' can [:read, :destroy, :delete], Message do |message| message.receiver == user end can :index, Message can :show, Message do |message| message.receiver == user end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems