2026-03-04 15:56:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\App\Container\Registrars;
|
|
|
|
|
|
|
|
|
|
use MintyPHP\App\AppContainer;
|
|
|
|
|
use MintyPHP\App\Container\ContainerRegistrar;
|
|
|
|
|
use MintyPHP\Repository\Auth\ApiTokenRepository;
|
|
|
|
|
use MintyPHP\Repository\Auth\RememberTokenRepository;
|
|
|
|
|
use MintyPHP\Service\Access\RoleService;
|
refactor(audit): extract audit domain into self-contained module
Move the entire audit subsystem (system audit, API audit, import audit,
user lifecycle audit, frontend telemetry) from core into modules/audit/.
Core decoupling via interface-based injection:
- AuditRecorderInterface replaces SystemAuditService in 10+ core services
- UserLifecycleAuditInterface / ImportAuditInterface for specialized flows
- NullAuditRecorder fallback when audit module is disabled
- ApiBootstrap/ApiResponse use null-safe callable resolvers
Module structure (modules/audit/):
- Manifest with routes, permissions, scheduler jobs, authorization policy
- 9 services, 8 repositories, 6 domain enums, 4 job handlers
- 33 page files, 4 JS files, 8 test files, migration scripts, i18n
Core cleanup:
- OperationsAuthorizationPolicy, UiCapabilityMap, PermissionService
surgically cleaned of audit-specific constants
- Sidebar template cleared of hardcoded audit navigation
- AuditModuleIsolationContractTest ensures no future core→module coupling
All quality gates pass: 1346 tests (19,276 assertions), PHPStan level 5
clean, architecture contracts verified.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:12:49 +01:00
|
|
|
use MintyPHP\Service\Audit\AuditRecorderInterface;
|
2026-03-04 15:56:58 +01:00
|
|
|
use MintyPHP\Service\Branding\BrandingFaviconService;
|
|
|
|
|
use MintyPHP\Service\Branding\BrandingLogoService;
|
|
|
|
|
use MintyPHP\Service\Branding\BrandingServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Org\DepartmentService;
|
|
|
|
|
use MintyPHP\Service\Settings\AdminSettingsService;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingCacheService;
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsApiPolicyGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsAppGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsDefaultsGateway;
|
test(auth): add 33 unit tests for AuthService and RememberMeService
AuthServiceTest (17 tests): canLoginToTenant, refreshSessionAuthState,
loginUserById, login email-not-verified branch.
RememberMeServiceTest (16 tests): rememberUser, autoLoginFromCookie
(all 11 branches), forgetCurrentUser, forgetAllForUser,
expireAllTokensByAdmin.
Also fixes: 3 PHPStan errors in FrontendTelemetryIngestService,
8 CS-Fixer violations in out-of-scope files (ordered_imports,
braces_position).
All quality gates green: QG-001 (429 tests/0 failures),
QG-002 (0 errors), QG-003 (11 arch tests pass), QG-006 (0 violations).
Task: AUTH-LOGIN-REVIEW-001
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:43:31 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingServicesFactory;
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsFrontendTelemetryGateway;
|
2026-03-10 22:48:10 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsLoginPersistenceGateway;
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsMetadataGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsMicrosoftGateway;
|
2026-03-09 19:16:26 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsSessionGateway;
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsSmtpGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsSystemAuditGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsUserLifecycleGateway;
|
2026-03-13 11:31:33 +01:00
|
|
|
use MintyPHP\Service\Settings\ThemeConfigGateway;
|
2026-03-04 15:56:58 +01:00
|
|
|
use MintyPHP\Service\Tenant\TenantService;
|
|
|
|
|
|
|
|
|
|
final class SettingsRegistrar implements ContainerRegistrar
|
|
|
|
|
{
|
|
|
|
|
public function register(AppContainer $container): void
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
$container->set(SettingsMetadataGateway::class, static fn (AppContainer $c): SettingsMetadataGateway => $c->get(SettingServicesFactory::class)->createSettingsMetadataGateway());
|
|
|
|
|
$container->set(SettingsDefaultsGateway::class, static fn (AppContainer $c): SettingsDefaultsGateway => $c->get(SettingServicesFactory::class)->createSettingsDefaultsGateway());
|
|
|
|
|
$container->set(SettingsAppGateway::class, static fn (AppContainer $c): SettingsAppGateway => $c->get(SettingServicesFactory::class)->createSettingsAppGateway());
|
|
|
|
|
$container->set(SettingsApiPolicyGateway::class, static fn (AppContainer $c): SettingsApiPolicyGateway => $c->get(SettingServicesFactory::class)->createSettingsApiPolicyGateway());
|
|
|
|
|
$container->set(SettingsUserLifecycleGateway::class, static fn (AppContainer $c): SettingsUserLifecycleGateway => $c->get(SettingServicesFactory::class)->createSettingsUserLifecycleGateway());
|
2026-03-09 19:16:26 +01:00
|
|
|
$container->set(SettingsSessionGateway::class, static fn (AppContainer $c): SettingsSessionGateway => $c->get(SettingServicesFactory::class)->createSettingsSessionGateway());
|
2026-03-06 00:44:52 +01:00
|
|
|
$container->set(SettingsSystemAuditGateway::class, static fn (AppContainer $c): SettingsSystemAuditGateway => $c->get(SettingServicesFactory::class)->createSettingsSystemAuditGateway());
|
|
|
|
|
$container->set(SettingsFrontendTelemetryGateway::class, static fn (AppContainer $c): SettingsFrontendTelemetryGateway => $c->get(SettingServicesFactory::class)->createSettingsFrontendTelemetryGateway());
|
|
|
|
|
$container->set(SettingsMicrosoftGateway::class, static fn (AppContainer $c): SettingsMicrosoftGateway => $c->get(SettingServicesFactory::class)->createSettingsMicrosoftGateway());
|
|
|
|
|
$container->set(SettingsSmtpGateway::class, static fn (AppContainer $c): SettingsSmtpGateway => $c->get(SettingServicesFactory::class)->createSettingsSmtpGateway());
|
2026-03-10 22:48:10 +01:00
|
|
|
$container->set(SettingsLoginPersistenceGateway::class, static fn (AppContainer $c): SettingsLoginPersistenceGateway => $c->get(SettingServicesFactory::class)->createSettingsLoginPersistenceGateway());
|
2026-03-04 15:56:58 +01:00
|
|
|
$container->set(SettingCacheService::class, static fn (AppContainer $c): SettingCacheService => $c->get(SettingServicesFactory::class)->createSettingCacheService());
|
|
|
|
|
$container->set(AdminSettingsService::class, static fn (AppContainer $c): AdminSettingsService => new AdminSettingsService(
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SettingsDefaultsGateway::class),
|
|
|
|
|
$c->get(SettingsAppGateway::class),
|
|
|
|
|
$c->get(SettingsApiPolicyGateway::class),
|
|
|
|
|
$c->get(SettingsUserLifecycleGateway::class),
|
2026-03-09 20:07:55 +01:00
|
|
|
$c->get(SettingsSessionGateway::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SettingsSystemAuditGateway::class),
|
|
|
|
|
$c->get(SettingsFrontendTelemetryGateway::class),
|
|
|
|
|
$c->get(SettingsMicrosoftGateway::class),
|
|
|
|
|
$c->get(SettingsSmtpGateway::class),
|
2026-03-10 22:48:10 +01:00
|
|
|
$c->get(SettingsLoginPersistenceGateway::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SettingsMetadataGateway::class),
|
2026-03-04 15:56:58 +01:00
|
|
|
$c->get(SettingCacheService::class),
|
|
|
|
|
$c->get(TenantService::class),
|
|
|
|
|
$c->get(RoleService::class),
|
|
|
|
|
$c->get(DepartmentService::class),
|
|
|
|
|
$c->get(RememberTokenRepository::class),
|
|
|
|
|
$c->get(ApiTokenRepository::class),
|
refactor(audit): extract audit domain into self-contained module
Move the entire audit subsystem (system audit, API audit, import audit,
user lifecycle audit, frontend telemetry) from core into modules/audit/.
Core decoupling via interface-based injection:
- AuditRecorderInterface replaces SystemAuditService in 10+ core services
- UserLifecycleAuditInterface / ImportAuditInterface for specialized flows
- NullAuditRecorder fallback when audit module is disabled
- ApiBootstrap/ApiResponse use null-safe callable resolvers
Module structure (modules/audit/):
- Manifest with routes, permissions, scheduler jobs, authorization policy
- 9 services, 8 repositories, 6 domain enums, 4 job handlers
- 33 page files, 4 JS files, 8 test files, migration scripts, i18n
Core cleanup:
- OperationsAuthorizationPolicy, UiCapabilityMap, PermissionService
surgically cleaned of audit-specific constants
- Sidebar template cleared of hardcoded audit navigation
- AuditModuleIsolationContractTest ensures no future core→module coupling
All quality gates pass: 1346 tests (19,276 assertions), PHPStan level 5
clean, architecture contracts verified.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:12:49 +01:00
|
|
|
$c->get(AuditRecorderInterface::class)
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
2026-03-13 11:31:33 +01:00
|
|
|
$container->set(ThemeConfigGateway::class, static fn (AppContainer $c): ThemeConfigGateway => $c->get(SettingServicesFactory::class)->createThemeConfigGateway());
|
2026-03-06 00:44:52 +01:00
|
|
|
// Branding services are registered here because they depend on settings gateways
|
|
|
|
|
// and are consumed alongside settings (e.g. in UserAccessPdfService and the admin UI).
|
2026-03-04 15:56:58 +01:00
|
|
|
$container->set(BrandingLogoService::class, static fn (AppContainer $c): BrandingLogoService => $c->get(BrandingServicesFactory::class)->createBrandingLogoService());
|
|
|
|
|
$container->set(BrandingFaviconService::class, static fn (AppContainer $c): BrandingFaviconService => $c->get(BrandingServicesFactory::class)->createBrandingFaviconService());
|
|
|
|
|
}
|
|
|
|
|
}
|