A documentation section has been added to the admin panel.
This commit is contained in:
34
app/application/app/Policies/DocumentationCategoryPolicy.php
Normal file
34
app/application/app/Policies/DocumentationCategoryPolicy.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\DocumentationCategory;
|
||||
use App\Models\User;
|
||||
|
||||
final readonly class DocumentationCategoryPolicy extends Policy
|
||||
{
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermission('documentation-category.view');
|
||||
}
|
||||
|
||||
public function view(User $user, DocumentationCategory $category): bool
|
||||
{
|
||||
return $user->hasPermission('documentation-category.view');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermission('documentation-category.create');
|
||||
}
|
||||
|
||||
public function update(User $user, DocumentationCategory $category): bool
|
||||
{
|
||||
return $user->hasPermission('documentation.update');
|
||||
}
|
||||
|
||||
public function delete(User $user, DocumentationCategory $category): bool
|
||||
{
|
||||
return $user->hasPermission('documentation-category.delete');
|
||||
}
|
||||
}
|
34
app/application/app/Policies/DocumentationPolicy.php
Normal file
34
app/application/app/Policies/DocumentationPolicy.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Documentation;
|
||||
use App\Models\User;
|
||||
|
||||
final readonly class DocumentationPolicy extends Policy
|
||||
{
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermission('documentation.view');
|
||||
}
|
||||
|
||||
public function view(User $user, Documentation $documentation): bool
|
||||
{
|
||||
return $user->hasPermission('documentation.view');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermission('documentation.create');
|
||||
}
|
||||
|
||||
public function update(User $user, Documentation $documentation): bool
|
||||
{
|
||||
return $user->hasPermission('documentation.update');
|
||||
}
|
||||
|
||||
public function delete(User $user, Documentation $documentation): bool
|
||||
{
|
||||
return $user->hasPermission('documentation.delete');
|
||||
}
|
||||
}
|
39
app/application/app/Policies/DocumentationVersionPolicy.php
Normal file
39
app/application/app/Policies/DocumentationVersionPolicy.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user