add policies

This commit is contained in:
2025-11-03 09:15:36 +05:00
parent e9e9f7dbd5
commit 711b5373da
14 changed files with 911 additions and 3 deletions

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\Branch\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\Branch\Models\Branch;
use Illuminate\Auth\Access\HandlesAuthorization;
class BranchPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Branch');
}
public function view(AuthUser $authUser, Branch $branch): bool
{
return $authUser->can('View:Branch');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Branch');
}
public function update(AuthUser $authUser, Branch $branch): bool
{
return $authUser->can('Update:Branch');
}
public function delete(AuthUser $authUser, Branch $branch): bool
{
return $authUser->can('Delete:Branch');
}
public function restore(AuthUser $authUser, Branch $branch): bool
{
return $authUser->can('Restore:Branch');
}
public function forceDelete(AuthUser $authUser, Branch $branch): bool
{
return $authUser->can('ForceDelete:Branch');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Branch');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Branch');
}
public function replicate(AuthUser $authUser, Branch $branch): bool
{
return $authUser->can('Replicate:Branch');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Branch');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\Card\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\Card\Models\Card;
use Illuminate\Auth\Access\HandlesAuthorization;
class CardPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Card');
}
public function view(AuthUser $authUser, Card $card): bool
{
return $authUser->can('View:Card');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Card');
}
public function update(AuthUser $authUser, Card $card): bool
{
return $authUser->can('Update:Card');
}
public function delete(AuthUser $authUser, Card $card): bool
{
return $authUser->can('Delete:Card');
}
public function restore(AuthUser $authUser, Card $card): bool
{
return $authUser->can('Restore:Card');
}
public function forceDelete(AuthUser $authUser, Card $card): bool
{
return $authUser->can('ForceDelete:Card');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Card');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Card');
}
public function replicate(AuthUser $authUser, Card $card): bool
{
return $authUser->can('Replicate:Card');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Card');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\CardOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\CardOrder\Models\CardOrder;
use Illuminate\Auth\Access\HandlesAuthorization;
class CardOrderPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:CardOrder');
}
public function view(AuthUser $authUser, CardOrder $cardOrder): bool
{
return $authUser->can('View:CardOrder');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:CardOrder');
}
public function update(AuthUser $authUser, CardOrder $cardOrder): bool
{
return $authUser->can('Update:CardOrder');
}
public function delete(AuthUser $authUser, CardOrder $cardOrder): bool
{
return $authUser->can('Delete:CardOrder');
}
public function restore(AuthUser $authUser, CardOrder $cardOrder): bool
{
return $authUser->can('Restore:CardOrder');
}
public function forceDelete(AuthUser $authUser, CardOrder $cardOrder): bool
{
return $authUser->can('ForceDelete:CardOrder');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:CardOrder');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:CardOrder');
}
public function replicate(AuthUser $authUser, CardOrder $cardOrder): bool
{
return $authUser->can('Replicate:CardOrder');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:CardOrder');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\CardOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\CardOrder\Models\CardState;
use Illuminate\Auth\Access\HandlesAuthorization;
class CardStatePolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:CardState');
}
public function view(AuthUser $authUser, CardState $cardState): bool
{
return $authUser->can('View:CardState');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:CardState');
}
public function update(AuthUser $authUser, CardState $cardState): bool
{
return $authUser->can('Update:CardState');
}
public function delete(AuthUser $authUser, CardState $cardState): bool
{
return $authUser->can('Delete:CardState');
}
public function restore(AuthUser $authUser, CardState $cardState): bool
{
return $authUser->can('Restore:CardState');
}
public function forceDelete(AuthUser $authUser, CardState $cardState): bool
{
return $authUser->can('ForceDelete:CardState');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:CardState');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:CardState');
}
public function replicate(AuthUser $authUser, CardState $cardState): bool
{
return $authUser->can('Replicate:CardState');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:CardState');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\CardOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\CardOrder\Models\CardType;
use Illuminate\Auth\Access\HandlesAuthorization;
class CardTypePolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:CardType');
}
public function view(AuthUser $authUser, CardType $cardType): bool
{
return $authUser->can('View:CardType');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:CardType');
}
public function update(AuthUser $authUser, CardType $cardType): bool
{
return $authUser->can('Update:CardType');
}
public function delete(AuthUser $authUser, CardType $cardType): bool
{
return $authUser->can('Delete:CardType');
}
public function restore(AuthUser $authUser, CardType $cardType): bool
{
return $authUser->can('Restore:CardType');
}
public function forceDelete(AuthUser $authUser, CardType $cardType): bool
{
return $authUser->can('ForceDelete:CardType');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:CardType');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:CardType');
}
public function replicate(AuthUser $authUser, CardType $cardType): bool
{
return $authUser->can('Replicate:CardType');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:CardType');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\CardPinOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\CardPinOrder\Models\CardPinOrder;
use Illuminate\Auth\Access\HandlesAuthorization;
class CardPinOrderPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:CardPinOrder');
}
public function view(AuthUser $authUser, CardPinOrder $cardPinOrder): bool
{
return $authUser->can('View:CardPinOrder');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:CardPinOrder');
}
public function update(AuthUser $authUser, CardPinOrder $cardPinOrder): bool
{
return $authUser->can('Update:CardPinOrder');
}
public function delete(AuthUser $authUser, CardPinOrder $cardPinOrder): bool
{
return $authUser->can('Delete:CardPinOrder');
}
public function restore(AuthUser $authUser, CardPinOrder $cardPinOrder): bool
{
return $authUser->can('Restore:CardPinOrder');
}
public function forceDelete(AuthUser $authUser, CardPinOrder $cardPinOrder): bool
{
return $authUser->can('ForceDelete:CardPinOrder');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:CardPinOrder');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:CardPinOrder');
}
public function replicate(AuthUser $authUser, CardPinOrder $cardPinOrder): bool
{
return $authUser->can('Replicate:CardPinOrder');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:CardPinOrder');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\Loan\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\Loan\Models\Loan;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Loan');
}
public function view(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('View:Loan');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Loan');
}
public function update(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Update:Loan');
}
public function delete(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Delete:Loan');
}
public function restore(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Restore:Loan');
}
public function forceDelete(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('ForceDelete:Loan');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Loan');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Loan');
}
public function replicate(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Replicate:Loan');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Loan');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\LoanOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\LoanOrder\Models\LoanOrder;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanOrderPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:LoanOrder');
}
public function view(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('View:LoanOrder');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:LoanOrder');
}
public function update(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Update:LoanOrder');
}
public function delete(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Delete:LoanOrder');
}
public function restore(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Restore:LoanOrder');
}
public function forceDelete(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('ForceDelete:LoanOrder');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:LoanOrder');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:LoanOrder');
}
public function replicate(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Replicate:LoanOrder');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:LoanOrder');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\LoanOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\LoanOrder\Models\LoanOrderRequiredDocs;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanOrderRequiredDocsPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:LoanOrderRequiredDocs');
}
public function view(AuthUser $authUser, LoanOrderRequiredDocs $loanOrderRequiredDocs): bool
{
return $authUser->can('View:LoanOrderRequiredDocs');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:LoanOrderRequiredDocs');
}
public function update(AuthUser $authUser, LoanOrderRequiredDocs $loanOrderRequiredDocs): bool
{
return $authUser->can('Update:LoanOrderRequiredDocs');
}
public function delete(AuthUser $authUser, LoanOrderRequiredDocs $loanOrderRequiredDocs): bool
{
return $authUser->can('Delete:LoanOrderRequiredDocs');
}
public function restore(AuthUser $authUser, LoanOrderRequiredDocs $loanOrderRequiredDocs): bool
{
return $authUser->can('Restore:LoanOrderRequiredDocs');
}
public function forceDelete(AuthUser $authUser, LoanOrderRequiredDocs $loanOrderRequiredDocs): bool
{
return $authUser->can('ForceDelete:LoanOrderRequiredDocs');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:LoanOrderRequiredDocs');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:LoanOrderRequiredDocs');
}
public function replicate(AuthUser $authUser, LoanOrderRequiredDocs $loanOrderRequiredDocs): bool
{
return $authUser->can('Replicate:LoanOrderRequiredDocs');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:LoanOrderRequiredDocs');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\LoanOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\LoanOrder\Models\LoanType;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanTypePolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:LoanType');
}
public function view(AuthUser $authUser, LoanType $loanType): bool
{
return $authUser->can('View:LoanType');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:LoanType');
}
public function update(AuthUser $authUser, LoanType $loanType): bool
{
return $authUser->can('Update:LoanType');
}
public function delete(AuthUser $authUser, LoanType $loanType): bool
{
return $authUser->can('Delete:LoanType');
}
public function restore(AuthUser $authUser, LoanType $loanType): bool
{
return $authUser->can('Restore:LoanType');
}
public function forceDelete(AuthUser $authUser, LoanType $loanType): bool
{
return $authUser->can('ForceDelete:LoanType');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:LoanType');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:LoanType');
}
public function replicate(AuthUser $authUser, LoanType $loanType): bool
{
return $authUser->can('Replicate:LoanType');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:LoanType');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\LoanPaidOffLetter\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\LoanPaidOffLetter\Models\LoanPaidOffLetter;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanPaidOffLetterPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:LoanPaidOffLetter');
}
public function view(AuthUser $authUser, LoanPaidOffLetter $loanPaidOffLetter): bool
{
return $authUser->can('View:LoanPaidOffLetter');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:LoanPaidOffLetter');
}
public function update(AuthUser $authUser, LoanPaidOffLetter $loanPaidOffLetter): bool
{
return $authUser->can('Update:LoanPaidOffLetter');
}
public function delete(AuthUser $authUser, LoanPaidOffLetter $loanPaidOffLetter): bool
{
return $authUser->can('Delete:LoanPaidOffLetter');
}
public function restore(AuthUser $authUser, LoanPaidOffLetter $loanPaidOffLetter): bool
{
return $authUser->can('Restore:LoanPaidOffLetter');
}
public function forceDelete(AuthUser $authUser, LoanPaidOffLetter $loanPaidOffLetter): bool
{
return $authUser->can('ForceDelete:LoanPaidOffLetter');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:LoanPaidOffLetter');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:LoanPaidOffLetter');
}
public function replicate(AuthUser $authUser, LoanPaidOffLetter $loanPaidOffLetter): bool
{
return $authUser->can('Replicate:LoanPaidOffLetter');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:LoanPaidOffLetter');
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\Province\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\Province\Models\Province;
use Illuminate\Auth\Access\HandlesAuthorization;
class ProvincePolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Province');
}
public function view(AuthUser $authUser, Province $province): bool
{
return $authUser->can('View:Province');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Province');
}
public function update(AuthUser $authUser, Province $province): bool
{
return $authUser->can('Update:Province');
}
public function delete(AuthUser $authUser, Province $province): bool
{
return $authUser->can('Delete:Province');
}
public function restore(AuthUser $authUser, Province $province): bool
{
return $authUser->can('Restore:Province');
}
public function forceDelete(AuthUser $authUser, Province $province): bool
{
return $authUser->can('ForceDelete:Province');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Province');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Province');
}
public function replicate(AuthUser $authUser, Province $province): bool
{
return $authUser->can('Replicate:Province');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Province');
}
}

View File

@@ -4,14 +4,14 @@ declare(strict_types=1);
namespace App\Policies;
use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Foundation\Auth\User as AuthUser;
use Spatie\Permission\Models\Role;
use Illuminate\Auth\Access\HandlesAuthorization;
class RolePolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Role');
@@ -66,4 +66,5 @@ class RolePolicy
{
return $authUser->can('Reorder:Role');
}
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:User');
}
public function view(AuthUser $authUser): bool
{
return $authUser->can('View:User');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:User');
}
public function update(AuthUser $authUser): bool
{
return $authUser->can('Update:User');
}
public function delete(AuthUser $authUser): bool
{
return $authUser->can('Delete:User');
}
public function restore(AuthUser $authUser): bool
{
return $authUser->can('Restore:User');
}
public function forceDelete(AuthUser $authUser): bool
{
return $authUser->can('ForceDelete:User');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:User');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:User');
}
public function replicate(AuthUser $authUser): bool
{
return $authUser->can('Replicate:User');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:User');
}
}