feat: Phase 2 - page CRUD, subscriber management, user management
This commit is contained in:
34
app/Policies/UserPolicy.php
Normal file
34
app/Policies/UserPolicy.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class UserPolicy
|
||||
{
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->isSuperadmin();
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->isSuperadmin();
|
||||
}
|
||||
|
||||
public function update(User $user, User $target): bool
|
||||
{
|
||||
return $user->isSuperadmin();
|
||||
}
|
||||
|
||||
public function delete(User $user, User $target): bool
|
||||
{
|
||||
if (! $user->isSuperadmin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $user->id !== $target->id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user