36 lines
916 B
PHP
36 lines
916 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Enums\Users\RoleEnum;
|
|
use App\Models\User;
|
|
use App\Models\Settings;
|
|
use App\Policies\Rules\UserStaticRules;
|
|
|
|
class SettingsPolicy
|
|
{
|
|
/**
|
|
* Determine whether the user can view any models.
|
|
*
|
|
* @param \App\Models\User $authUser
|
|
* @return boolean
|
|
*/
|
|
public function viewAny(User $authUser): bool
|
|
{
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor);
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can update the model.
|
|
*
|
|
* @param \App\Models\User $authUser
|
|
* @param \App\Models\Settings $settings
|
|
* @return boolean
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
|
|
*/
|
|
public function update(User $authUser, Settings $settings): bool
|
|
{
|
|
// phpcs:enable
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor);
|
|
}
|
|
}
|