Class: Dscf::Credit::LoanApplicationDatumPolicy

Inherits:
ApplicationPolicy
  • Object
show all
Defined in:
app/policies/dscf/credit/loan_application_datum_policy.rb

Defined Under Namespace

Classes: Scope

Constant Summary

Constants inherited from ApplicationPolicy

ApplicationPolicy::ADMIN_ROLES

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#activate?, #approve?, #deactivate?, #reject?, #request_modification?, #resubmit?, #show?, #submit?, #update?

Instance Method Details

#owned_record?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
# File 'app/policies/dscf/credit/loan_application_datum_policy.rb', line 22

def owned_record?
  if user.has_role?("USER")
    record.loan_application&.user_id == user.id
  elsif user.has_role?("FACILITATOR")
    record.loan_application&.backer_type == "Dscf::Core::User" && record.loan_application&.backer_id == user.id
  else
    true
  end
end