adds logging and policies

This commit is contained in:
2026-02-03 11:47:08 +01:00
parent 9583b7030c
commit c693cde038
23 changed files with 2151 additions and 16 deletions

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Answer;
use App\Models\User;
final class AnswerPolicy
{
/**
* Determine whether the user can view any answers.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the answer.
*/
public function view(User $user, Answer $answer): bool
{
return true;
}
/**
* Determine whether the user can create answers.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the answer.
*/
public function update(User $user, Answer $answer): bool
{
return false;
}
/**
* Determine whether the user can delete the answer.
*/
public function delete(User $user, Answer $answer): bool
{
return false;
}
/**
* Determine whether the user can restore the answer.
*/
public function restore(User $user, Answer $answer): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the answer.
*/
public function forceDelete(User $user, Answer $answer): bool
{
return false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Category;
use App\Models\User;
final class CategoryPolicy
{
/**
* Determine whether the user can view any categories.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the category.
*/
public function view(User $user, Category $category): bool
{
return true;
}
/**
* Determine whether the user can create categories.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the category.
*/
public function update(User $user, Category $category): bool
{
return false;
}
/**
* Determine whether the user can delete the category.
*/
public function delete(User $user, Category $category): bool
{
return false;
}
/**
* Determine whether the user can restore the category.
*/
public function restore(User $user, Category $category): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the category.
*/
public function forceDelete(User $user, Category $category): bool
{
return false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Log;
use App\Models\User;
final class LogPolicy
{
/**
* Determine whether the user can view any logs.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the log.
*/
public function view(User $user, Log $log): bool
{
return true;
}
/**
* Determine whether the user can create logs.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the log.
*/
public function update(User $user, Log $log): bool
{
return false;
}
/**
* Determine whether the user can delete the log.
*/
public function delete(User $user, Log $log): bool
{
return false;
}
/**
* Determine whether the user can restore the log.
*/
public function restore(User $user, Log $log): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the log.
*/
public function forceDelete(User $user, Log $log): bool
{
return false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\QuestionGroup;
use App\Models\User;
final class QuestionGroupPolicy
{
/**
* Determine whether the user can view any question groups.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the question group.
*/
public function view(User $user, QuestionGroup $questionGroup): bool
{
return true;
}
/**
* Determine whether the user can create question groups.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the question group.
*/
public function update(User $user, QuestionGroup $questionGroup): bool
{
return false;
}
/**
* Determine whether the user can delete the question group.
*/
public function delete(User $user, QuestionGroup $questionGroup): bool
{
return false;
}
/**
* Determine whether the user can restore the question group.
*/
public function restore(User $user, QuestionGroup $questionGroup): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the question group.
*/
public function forceDelete(User $user, QuestionGroup $questionGroup): bool
{
return false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Question;
use App\Models\User;
final class QuestionPolicy
{
/**
* Determine whether the user can view any questions.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the question.
*/
public function view(User $user, Question $question): bool
{
return true;
}
/**
* Determine whether the user can create questions.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the question.
*/
public function update(User $user, Question $question): bool
{
return true;
}
/**
* Determine whether the user can delete the question.
*/
public function delete(User $user, Question $question): bool
{
return false;
}
/**
* Determine whether the user can restore the question.
*/
public function restore(User $user, Question $question): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the question.
*/
public function forceDelete(User $user, Question $question): bool
{
return false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Screening;
use App\Models\User;
final class ScreeningPolicy
{
/**
* Determine whether the user can view any screenings.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the screening.
*/
public function view(User $user, Screening $screening): bool
{
return true;
}
/**
* Determine whether the user can create screenings.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the screening.
*/
public function update(User $user, Screening $screening): bool
{
return false;
}
/**
* Determine whether the user can delete the screening.
*/
public function delete(User $user, Screening $screening): bool
{
return false;
}
/**
* Determine whether the user can restore the screening.
*/
public function restore(User $user, Screening $screening): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the screening.
*/
public function forceDelete(User $user, Screening $screening): bool
{
return false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Session;
use App\Models\User;
final class SessionPolicy
{
/**
* Determine whether the user can view any sessions.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the session.
*/
public function view(User $user, Session $session): bool
{
return true;
}
/**
* Determine whether the user can create sessions.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the session.
*/
public function update(User $user, Session $session): bool
{
return false;
}
/**
* Determine whether the user can delete the session.
*/
public function delete(User $user, Session $session): bool
{
return false;
}
/**
* Determine whether the user can restore the session.
*/
public function restore(User $user, Session $session): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the session.
*/
public function forceDelete(User $user, Session $session): bool
{
return false;
}
}