Enhance user role checks and update card order tabs visibility
- Updated the isSystemUser method to include currency maintainers in role checks. - Modified getTabs method in ListCardOrders to return an empty array for non-system users. - Added a dehydrate state function for Turkmen phone numbers in UserForm schema.
This commit is contained in:
69
app/Modules/CurrencyRate/Policies/CurrencyRatePolicy.php
Normal file
69
app/Modules/CurrencyRate/Policies/CurrencyRatePolicy.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\CurrencyRate\Policies;
|
||||
|
||||
use App\Modules\CurrencyRate\Models\CurrencyRate;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
|
||||
class CurrencyRatePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:CurrencyRate');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('View:CurrencyRate');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:CurrencyRate');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Update:CurrencyRate');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Delete:CurrencyRate');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Restore:CurrencyRate');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:CurrencyRate');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:CurrencyRate');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:CurrencyRate');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Replicate:CurrencyRate');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:CurrencyRate');
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,6 @@ trait RoleCheckers
|
||||
*/
|
||||
public function isSystemUser(): bool
|
||||
{
|
||||
return $this->isAdmin() || $this->isOperator();
|
||||
return $this->isAdmin() || $this->isOperator() || $this->isCurrencyMaintainer();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user