ldc-com-app-bo/app/Policies/TenantPolicy.php

77 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2025-05-20 16:20:23 +02:00
<?php
namespace App\Policies;
use App\Enums\UserRolesEnum;
use App\Models\User;
use App\Policies\Rules\UserStaticRules;
class TenantPolicy
{
/**
* 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, UserRolesEnum::admin);
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function view(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, UserRolesEnum::admin);
}
2025-05-20 16:20:23 +02:00
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function create(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, UserRolesEnum::admin);
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function update(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, UserRolesEnum::admin);
}
2025-05-20 16:20:23 +02:00
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function delete(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, UserRolesEnum::admin);
}
/**
* Determine whether the user can duplicate the model.
*
* @param \App\Models\User $authUser
2025-05-20 16:20:23 +02:00
* @return boolean
*/
public function duplicate(User $authUser): bool
2025-05-20 16:20:23 +02:00
{
return UserStaticRules::atLeastRole($authUser, UserRolesEnum::admin);
}
}