Sha256: 9370f4f6e55fd954e9755830be44caacd87c5c631cd6f57402baa7b167a6879e
Contents?: true
Size: 566 Bytes
Versions: 22
Compression:
Stored size: 566 Bytes
Contents
class Ability include CanCan::Ability def initialize(user) if !user.nil? and (user.admin? or user.manager?) can :read, :all can :access, :rails_admin # grant access to rails_admin can :dashboard # grant access to the dashboard if user.admin? admin_ui(user) elsif user.manager? manager_ui(user) end end end def admin_ui(user) can :manage, :all end def manager_ui(user) cannot :manage, Menu cannot [:edit, :destroy, :new, :create], User can :edit, user end end
Version data entries
22 entries across 22 versions & 2 rubygems