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