Sha256: 539505aeb8e1e11201bd2a887c6f9240b64bc8b08dc8750af133e4b25c0dee94
Contents?: true
Size: 546 Bytes
Versions: 39
Compression:
Stored size: 546 Bytes
Contents
class AgentPolicy < ApplicationPolicy def index? true end def show? case user.try(:role).try(:name) when 'Administrator' true when 'Librarian' true if record.required_role_id <= 3 when 'User' true if record.required_role_id <= 2 else true if record.required_role_id <= 1 end end def create? true if user.try(:has_role?, 'Librarian') end def update? true if user.try(:has_role?, 'Librarian') end def destroy? true if user.try(:has_role?, 'Librarian') end end
Version data entries
39 entries across 38 versions & 2 rubygems