Files
breadcrumb-the-shire/lib/Service/User/UserDirectoryGateway.php

81 lines
2.2 KiB
PHP
Raw Normal View History

2026-02-23 12:58:19 +01:00
<?php
namespace MintyPHP\Service\User;
use MintyPHP\Repository\Access\RoleRepository;
use MintyPHP\Repository\Org\DepartmentRepository;
use MintyPHP\Repository\Tenant\TenantRepository;
class UserDirectoryGateway
{
2026-03-04 15:56:58 +01:00
public function __construct(
private readonly UserRepositoryFactory $userRepositoryFactory
) {
}
2026-02-23 12:58:19 +01:00
public function listTenantIds(): array
{
2026-03-04 15:56:58 +01:00
return $this->tenantRepository()->listIds();
2026-02-23 12:58:19 +01:00
}
public function listTenantsByIds(array $tenantIds): array
{
2026-03-04 15:56:58 +01:00
return $this->tenantRepository()->listByIds($tenantIds);
2026-02-23 12:58:19 +01:00
}
public function findTenant(int $tenantId): ?array
{
2026-03-04 15:56:58 +01:00
return $this->tenantRepository()->find($tenantId);
}
public function findTenantByUuid(string $tenantUuid): ?array
{
return $this->tenantRepository()->findByUuid($tenantUuid);
2026-02-23 12:58:19 +01:00
}
public function listActiveTenantIdsByIds(array $tenantIds): array
{
2026-03-04 15:56:58 +01:00
return $this->tenantRepository()->listActiveIdsByIds($tenantIds);
2026-02-23 12:58:19 +01:00
}
public function listActiveRoleIds(): array
{
2026-03-04 15:56:58 +01:00
return $this->roleRepository()->listActiveIds();
2026-02-23 12:58:19 +01:00
}
public function listRolesByIds(array $roleIds): array
{
2026-03-04 15:56:58 +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-04 15:56:58 +01:00
return $this->departmentRepository()->listByIds($departmentIds, $includeInactive);
2026-02-23 12:58:19 +01:00
}
public function listActiveDepartmentIdsByTenantIds(array $tenantIds): array
{
2026-03-04 15:56:58 +01:00
return $this->departmentRepository()->listActiveIdsByTenantIds($tenantIds);
2026-02-23 12:58:19 +01:00
}
public function listDepartmentsByTenantIds(array $tenantIds): array
{
2026-03-04 15:56:58 +01:00
return $this->departmentRepository()->listByTenantIds($tenantIds);
}
private function tenantRepository(): TenantRepository
{
return $this->userRepositoryFactory->createTenantRepository();
}
private function roleRepository(): RoleRepository
{
return $this->userRepositoryFactory->createRoleRepository();
}
private function departmentRepository(): DepartmentRepository
{
return $this->userRepositoryFactory->createDepartmentRepository();
2026-02-23 12:58:19 +01:00
}
}