81 lines
2.2 KiB
PHP
81 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Service\User;
|
|
|
|
use MintyPHP\Repository\Access\RoleRepository;
|
|
use MintyPHP\Repository\Org\DepartmentRepository;
|
|
use MintyPHP\Repository\Tenant\TenantRepository;
|
|
|
|
class UserDirectoryGateway
|
|
{
|
|
public function __construct(
|
|
private readonly UserRepositoryFactory $userRepositoryFactory
|
|
) {
|
|
}
|
|
|
|
public function listTenantIds(): array
|
|
{
|
|
return $this->tenantRepository()->listIds();
|
|
}
|
|
|
|
public function listTenantsByIds(array $tenantIds): array
|
|
{
|
|
return $this->tenantRepository()->listByIds($tenantIds);
|
|
}
|
|
|
|
public function findTenant(int $tenantId): ?array
|
|
{
|
|
return $this->tenantRepository()->find($tenantId);
|
|
}
|
|
|
|
public function findTenantByUuid(string $tenantUuid): ?array
|
|
{
|
|
return $this->tenantRepository()->findByUuid($tenantUuid);
|
|
}
|
|
|
|
public function listActiveTenantIdsByIds(array $tenantIds): array
|
|
{
|
|
return $this->tenantRepository()->listActiveIdsByIds($tenantIds);
|
|
}
|
|
|
|
public function listActiveRoleIds(): array
|
|
{
|
|
return $this->roleRepository()->listActiveIds();
|
|
}
|
|
|
|
public function listRolesByIds(array $roleIds): array
|
|
{
|
|
return $this->roleRepository()->listByIds($roleIds);
|
|
}
|
|
|
|
public function listDepartmentsByIds(array $departmentIds, bool $includeInactive = true): array
|
|
{
|
|
return $this->departmentRepository()->listByIds($departmentIds, $includeInactive);
|
|
}
|
|
|
|
public function listActiveDepartmentIdsByTenantIds(array $tenantIds): array
|
|
{
|
|
return $this->departmentRepository()->listActiveIdsByTenantIds($tenantIds);
|
|
}
|
|
|
|
public function listDepartmentsByTenantIds(array $tenantIds): array
|
|
{
|
|
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();
|
|
}
|
|
}
|