instances added god may help

This commit is contained in:
2026-02-23 12:58:19 +01:00
parent 25370a1a55
commit 99db252f60
290 changed files with 9858 additions and 4914 deletions

View File

@@ -5,8 +5,7 @@ namespace MintyPHP\Service\User;
use MintyPHP\Http\Request;
use MintyPHP\I18n;
use MintyPHP\Repository\Tenant\TenantRepository;
use MintyPHP\Repository\Tenant\UserTenantRepository;
use MintyPHP\Service\Auth\TenantSsoService;
use MintyPHP\Service\Auth\AuthServicesFactory;
class UserAccessTemplateService
{
@@ -63,6 +62,7 @@ class UserAccessTemplateService
private static function resolveTenantLoginUrl(array $user, string $locale): string
{
$tenantSsoService = (new AuthServicesFactory())->createTenantSsoService();
$tenantIds = [];
$primaryTenantId = (int) ($user['primary_tenant_id'] ?? 0);
$currentTenantId = (int) ($user['current_tenant_id'] ?? 0);
@@ -75,18 +75,21 @@ class UserAccessTemplateService
$userId = (int) ($user['id'] ?? 0);
if (!$tenantIds && $userId > 0) {
$tenantIds = array_values(array_map('intval', UserTenantRepository::listTenantIdsByUserId($userId)));
$tenantIds = array_values(array_map(
'intval',
(new UserServicesFactory())->createUserTenantRepository()->listTenantIdsByUserId($userId)
));
}
foreach ($tenantIds as $tenantId) {
if ($tenantId <= 0) {
continue;
}
$tenant = TenantRepository::find($tenantId);
$tenant = (new TenantRepository())->find($tenantId);
if (!$tenant || (string) ($tenant['status'] ?? 'active') !== 'active') {
continue;
}
$tenantSlug = TenantSsoService::tenantLoginSlug($tenant);
$tenantSlug = $tenantSsoService->tenantLoginSlug($tenant);
if ($tenantSlug !== '') {
return appUrl(Request::withLocale('login?tenant=' . rawurlencode($tenantSlug), $locale));
}