Sha256: 2cc40448a1fe00dd554222281df00ea11195caf4f09ecec7f1ac84cb110ec746
Contents?: true
Size: 847 Bytes
Versions: 65
Compression:
Stored size: 847 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" module Renalware module Letters class LetterPolicy < BasePolicy alias_attribute :letter, :record def author? has_write_privileges? end def update? false end def submit_for_review? false end def reject? false end def approve? false end def complete? false end def destroy? return false if user_is_read_only? return false if %i(approved completed).include?(letter_state) user_is_admin? || user_is_super_admin? || letter.author == user || letter.created_by == user end private def letter_state record.state.downcase.to_sym end end end end
Version data entries
65 entries across 65 versions & 1 rubygems