forked from fa/breadcrumb-the-shire
34 lines
917 B
PHP
34 lines
917 B
PHP
<?php
|
|
|
|
namespace MintyPHP\Service\Auth;
|
|
|
|
use MintyPHP\Service\Tenant\TenantScopeService;
|
|
|
|
class AuthScopeGateway
|
|
{
|
|
public function __construct(
|
|
private readonly TenantScopeService $tenantScopeService
|
|
) {
|
|
}
|
|
|
|
public function hasGlobalAccess(int $userId): bool
|
|
{
|
|
return $this->tenantScopeService->hasGlobalAccess($userId);
|
|
}
|
|
|
|
public function getUserTenantIds(int $userId): array
|
|
{
|
|
return $this->tenantScopeService->getUserTenantIds($userId);
|
|
}
|
|
|
|
public function canAccess(string $resourceType, int $resourceId, int $userId): bool
|
|
{
|
|
return $this->tenantScopeService->canAccess($resourceType, $resourceId, $userId);
|
|
}
|
|
|
|
public function resourceBelongsToTenant(string $resourceType, int $resourceId, int $tenantId): bool
|
|
{
|
|
return $this->tenantScopeService->resourceBelongsToTenant($resourceType, $resourceId, $tenantId);
|
|
}
|
|
}
|