From f17262393446dab6ecab1e72eb5ed962ca58b466 Mon Sep 17 00:00:00 2001 From: Leon Date: Thu, 8 Jan 2026 12:19:02 +0100 Subject: [PATCH] feat: try fix pipeline --- .gitlab-ci.yml | 2 +- app/Policies/UserPolicy.php | 65 +++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 app/Policies/UserPolicy.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a833361..d1fc554 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ test: DB_DATABASE: ":memory:" before_script: - - apt-get update && apt-get install -y git zip unzip + - apt-get update && apt-get install -y git zip unzip php8.4-intl - composer install --no-interaction --prefer-dist # on génère un .env de base pour que Laravel soit content - cp .env.example .env || touch .env diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php new file mode 100644 index 0000000..d350cd3 --- /dev/null +++ b/app/Policies/UserPolicy.php @@ -0,0 +1,65 @@ +role === UserRole::ADMIN; + } + + /** + * Determine whether the user can view the model. + */ + public function view(User $user, User $model): bool + { + return $user->role === UserRole::ADMIN; + } + + /** + * Determine whether the user can create models. + */ + public function create(User $user): bool + { + return $user->role === UserRole::ADMIN; + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, User $model): bool + { + return $user->role === UserRole::ADMIN; + } + + /** + * Determine whether the user can delete the model. + */ + public function delete(User $user, User $model): bool + { + return $user->role === UserRole::ADMIN; + } + + /** + * Determine whether the user can restore the model. + */ + public function restore(User $user, User $model): bool + { + return $user->role === UserRole::ADMIN; + } + + /** + * Determine whether the user can permanently delete the model. + */ + public function forceDelete(User $user, User $model): bool + { + return $user->role === UserRole::ADMIN; + } +}