mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
2.x
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
|
||||
@ -10,26 +9,26 @@ class ProjectPolicy
|
||||
{
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->role === UserRole::ADMIN;
|
||||
return $user->isAdmin();
|
||||
}
|
||||
|
||||
public function view(User $user, Project $project): bool
|
||||
{
|
||||
return $user->role === UserRole::ADMIN || $project->users->contains($user);
|
||||
return $user->isAdmin() || $project->users->contains($user);
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->role === UserRole::ADMIN;
|
||||
return $user->isAdmin();
|
||||
}
|
||||
|
||||
public function update(User $user, Project $project): bool
|
||||
{
|
||||
return $user->role === UserRole::ADMIN;
|
||||
return $user->isAdmin();
|
||||
}
|
||||
|
||||
public function delete(User $user, Project $project): bool
|
||||
{
|
||||
return $user->role === UserRole::ADMIN;
|
||||
return $user->isAdmin();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user