feat(add Roles & Permission for Users)
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 1m18s
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 1m18s
This commit is contained in:
70
app/Policies/MemberGroupPolicy.php
Normal file
70
app/Policies/MemberGroupPolicy.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\MemberGroup;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class MemberGroupPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:MemberGroup');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, MemberGroup $memberGroup): bool
|
||||
{
|
||||
return $authUser->can('View:MemberGroup');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:MemberGroup');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, MemberGroup $memberGroup): bool
|
||||
{
|
||||
return $authUser->can('Update:MemberGroup');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, MemberGroup $memberGroup): bool
|
||||
{
|
||||
return $authUser->can('Delete:MemberGroup');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, MemberGroup $memberGroup): bool
|
||||
{
|
||||
return $authUser->can('Restore:MemberGroup');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, MemberGroup $memberGroup): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:MemberGroup');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:MemberGroup');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:MemberGroup');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, MemberGroup $memberGroup): bool
|
||||
{
|
||||
return $authUser->can('Replicate:MemberGroup');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:MemberGroup');
|
||||
}
|
||||
|
||||
}
|
||||
70
app/Policies/MemberPolicy.php
Normal file
70
app/Policies/MemberPolicy.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\Member;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class MemberPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:Member');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Member $member): bool
|
||||
{
|
||||
return $authUser->can('View:Member');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Member');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Member $member): bool
|
||||
{
|
||||
return $authUser->can('Update:Member');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Member $member): bool
|
||||
{
|
||||
return $authUser->can('Delete:Member');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Member $member): bool
|
||||
{
|
||||
return $authUser->can('Restore:Member');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Member $member): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Member');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Member');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Member');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Member $member): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Member');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Member');
|
||||
}
|
||||
|
||||
}
|
||||
70
app/Policies/MembershipPolicy.php
Normal file
70
app/Policies/MembershipPolicy.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\Membership;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class MembershipPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:Membership');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Membership $membership): bool
|
||||
{
|
||||
return $authUser->can('View:Membership');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Membership');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Membership $membership): bool
|
||||
{
|
||||
return $authUser->can('Update:Membership');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Membership $membership): bool
|
||||
{
|
||||
return $authUser->can('Delete:Membership');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Membership $membership): bool
|
||||
{
|
||||
return $authUser->can('Restore:Membership');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Membership $membership): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Membership');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Membership');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Membership');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Membership $membership): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Membership');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Membership');
|
||||
}
|
||||
|
||||
}
|
||||
70
app/Policies/PackagePolicy.php
Normal file
70
app/Policies/PackagePolicy.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\Package;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class PackagePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:Package');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Package $package): bool
|
||||
{
|
||||
return $authUser->can('View:Package');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Package');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Package $package): bool
|
||||
{
|
||||
return $authUser->can('Update:Package');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Package $package): bool
|
||||
{
|
||||
return $authUser->can('Delete:Package');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Package $package): bool
|
||||
{
|
||||
return $authUser->can('Restore:Package');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Package $package): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Package');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Package');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Package');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Package $package): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Package');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Package');
|
||||
}
|
||||
|
||||
}
|
||||
70
app/Policies/RolePolicy.php
Normal file
70
app/Policies/RolePolicy.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $authUser->can('View:Role');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Role');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $authUser->can('Update:Role');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $authUser->can('Delete:Role');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $authUser->can('Restore:Role');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Role');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Role');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Role');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Role');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Role');
|
||||
}
|
||||
|
||||
}
|
||||
70
app/Policies/ServicePolicy.php
Normal file
70
app/Policies/ServicePolicy.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\Service;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ServicePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:Service');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Service $service): bool
|
||||
{
|
||||
return $authUser->can('View:Service');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Service');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Service $service): bool
|
||||
{
|
||||
return $authUser->can('Update:Service');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Service $service): bool
|
||||
{
|
||||
return $authUser->can('Delete:Service');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Service $service): bool
|
||||
{
|
||||
return $authUser->can('Restore:Service');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Service $service): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Service');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Service');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Service');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Service $service): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Service');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Service');
|
||||
}
|
||||
|
||||
}
|
||||
67
app/Policies/UserPolicy.php
Normal file
67
app/Policies/UserPolicy.php
Normal 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');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user