5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/policies/dscf/credit/eligible_credit_line_policy.rb', line 5
def resolve
return scope.none unless user.has_permission?(index_permission_code)
return scope.all if user.super_admin?
return scope.all if admin_role?
if user.has_role?("USER")
scope.joins(loan_profile: :loan_application)
.where(dscf_credit_loan_applications: { user_id: user.id })
elsif user.has_role?("FACILITATOR")
scope.joins(loan_profile: :loan_application)
.where(
dscf_credit_loan_applications: { backer_type: "Dscf::Core::User", backer_id: user.id }
)
else
scope.none
end
end
|