major update

This commit is contained in:
2026-03-04 15:56:58 +01:00
parent 16759a2732
commit 8f4dd5840d
478 changed files with 24313 additions and 8201 deletions

View File

@@ -3,35 +3,26 @@
namespace MintyPHP\Service\User;
use MintyPHP\Service\Tenant\TenantScopeService;
use MintyPHP\Service\Tenant\TenantServicesFactory;
class UserScopeGateway
{
public function __construct(private readonly ?TenantScopeService $tenantScopeService = null)
{
public function __construct(
private readonly TenantScopeService $tenantScopeService
) {
}
public function hasGlobalAccess(int $userId): bool
{
return $this->tenantScopeService()->hasGlobalAccess($userId);
return $this->tenantScopeService->hasGlobalAccess($userId);
}
public function canAccess(string $resourceType, int $resourceId, int $userId): bool
{
return $this->tenantScopeService()->canAccess($resourceType, $resourceId, $userId);
return $this->tenantScopeService->canAccess($resourceType, $resourceId, $userId);
}
public function getUserTenantIds(int $userId): array
{
return $this->tenantScopeService()->getUserTenantIds($userId);
}
private function tenantScopeService(): TenantScopeService
{
if ($this->tenantScopeService instanceof TenantScopeService) {
return $this->tenantScopeService;
}
return (new TenantServicesFactory())->createTenantScopeService();
return $this->tenantScopeService->getUserTenantIds($userId);
}
}