40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\DocumentationVersion;
|
|
use App\Models\User;
|
|
|
|
final readonly class DocumentationVersionPolicy extends Policy
|
|
{
|
|
public function viewAny(User $user): bool
|
|
{
|
|
// Not a mistake or typo. Shared rights with Documentation.
|
|
return $user->hasPermission('documentation.view');
|
|
}
|
|
|
|
public function view(User $user, DocumentationVersion $documentationVersion): bool
|
|
{
|
|
// Not a mistake or typo. Shared rights with Documentation.
|
|
return $user->hasPermission('documentation.view');
|
|
}
|
|
|
|
public function create(User $user): bool
|
|
{
|
|
// Not a mistake or typo. Shared rights with Documentation.
|
|
return $user->hasPermission('documentation.create');
|
|
}
|
|
|
|
public function update(User $user, DocumentationVersion $documentationVersion): bool
|
|
{
|
|
// Not a mistake or typo. Shared rights with Documentation.
|
|
return $user->hasPermission('documentation.update');
|
|
}
|
|
|
|
public function delete(User $user, DocumentationVersion $documentationVersion): bool
|
|
{
|
|
// Not a mistake or typo. Shared rights with Documentation.
|
|
return $user->hasPermission('documentation.delete');
|
|
}
|
|
}
|