loan order permissions
This commit is contained in:
@@ -12,11 +12,7 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,6 +24,14 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator()) {
|
||||
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,11 +40,7 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,6 +52,14 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator()) {
|
||||
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,6 +72,14 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator()) {
|
||||
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user