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; + } +}