mirror of
https://gitlab.com/izyim/prototypes/ddd-example.git
synced 2026-08-21 13:34:19 +00:00
39 lines
745 B
PHP
39 lines
745 B
PHP
<?php
|
|
|
|
namespace Src\Zone\User\Domain\Policies;
|
|
|
|
use Src\Zone\User\Domain\Model\User;
|
|
|
|
class UserPolicy
|
|
{
|
|
public function findAll(): bool
|
|
{
|
|
return auth()->user()?->is_admin ?? false;
|
|
}
|
|
|
|
public function findById(): bool
|
|
{
|
|
return auth()->user()?->is_admin ?? false;
|
|
}
|
|
|
|
public function findByEmail(): bool
|
|
{
|
|
return auth()->user()?->is_admin ?? false;
|
|
}
|
|
|
|
public function store(): bool
|
|
{
|
|
return auth()->user()?->is_admin ?? false;
|
|
}
|
|
|
|
public function update(User $user): bool
|
|
{
|
|
return auth()->user()?->is_admin || auth()->user()?->id == $user->id;
|
|
}
|
|
|
|
public function delete(): bool
|
|
{
|
|
return auth()->user()?->is_admin ?? false;
|
|
}
|
|
|
|
} |