rubyforgood/casa

View on GitHub
app/policies/reimbursement_policy.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class ReimbursementPolicy < ApplicationPolicy
  class Scope < ApplicationPolicy::Scope
    def resolve
      # scope must INNER JOIN casa_case
      scope.where(casa_case: {casa_org_id: user.casa_org.id})
    end
  end

  def index?
    (is_admin? || is_supervisor?) && reimbursement_enabled?
  end

  def datatable?
    (is_admin? || is_supervisor?) && reimbursement_enabled?
  end

  def change_complete_status?
    index? && reimbursement_enabled?
  end
end