2026-02-23 12:58:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Service\User;
|
|
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
2026-02-23 12:58:19 +01:00
|
|
|
|
|
|
|
|
class UserDirectoryGateway
|
|
|
|
|
{
|
2026-03-04 15:56:58 +01:00
|
|
|
public function __construct(
|
2026-03-05 11:17:42 +01:00
|
|
|
private readonly TenantRepositoryInterface $tenantRepository,
|
|
|
|
|
private readonly RoleRepositoryInterface $roleRepository,
|
|
|
|
|
private readonly DepartmentRepositoryInterface $departmentRepository,
|
2026-03-04 15:56:58 +01:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 12:58:19 +01:00
|
|
|
public function listTenantIds(): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->listIds();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listTenantsByIds(array $tenantIds): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->listByIds($tenantIds);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findTenant(int $tenantId): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->find($tenantId);
|
2026-03-04 15:56:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findTenantByUuid(string $tenantUuid): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->findByUuid($tenantUuid);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listActiveTenantIdsByIds(array $tenantIds): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->listActiveIdsByIds($tenantIds);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listActiveRoleIds(): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->roleRepository->listActiveIds();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listRolesByIds(array $roleIds): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->roleRepository->listByIds($roleIds);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listDepartmentsByIds(array $departmentIds, bool $includeInactive = true): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->departmentRepository->listByIds($departmentIds, $includeInactive);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listActiveDepartmentIdsByTenantIds(array $tenantIds): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->departmentRepository->listActiveIdsByTenantIds($tenantIds);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function listDepartmentsByTenantIds(array $tenantIds): array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->departmentRepository->listByTenantIds($tenantIds);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
}
|