feat: module architecture improvements — session keys, dependency graph, event dispatcher, deactivation hooks
Six targeted improvements to the modular monolith platform: 1. Fix AddressBook session key prefix to follow module.<id>.* convention 2. Move ADDRESS_BOOK_VIEW permission constant from core PermissionService into module 3. Add declarative JSON schema for module manifests (.agents/contracts/) 4. Add `requires` field with missing-dependency and circular-dependency detection 5. Add lightweight fire-and-forget event dispatcher (user.created/deleted/login/logout) 6. Add module deactivation hook interface and CLI script (bin/module-deactivate.php) Includes 15 new architecture/unit tests covering all new functionality. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\App\AppContainer;
|
||||
use MintyPHP\App\Module\ModuleEventDispatcher;
|
||||
use MintyPHP\Http\CookieStoreInterface;
|
||||
use MintyPHP\Http\RequestRuntimeInterface;
|
||||
use MintyPHP\Http\SessionStoreInterface;
|
||||
@@ -100,7 +101,8 @@ class AuthServicesFactory
|
||||
$this->createTenantSsoService(),
|
||||
$this->createAuthSessionTenantContextService(),
|
||||
$this->auditServicesFactory->createSystemAuditService(),
|
||||
$this->sessionStore
|
||||
$this->sessionStore,
|
||||
$this->resolveEventDispatcher()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,6 +150,15 @@ class AuthServicesFactory
|
||||
return new OidcHttpGateway();
|
||||
}
|
||||
|
||||
private function resolveEventDispatcher(): ?ModuleEventDispatcher
|
||||
{
|
||||
if ($this->appContainer->has(ModuleEventDispatcher::class)) {
|
||||
$dispatcher = $this->appContainer->get(ModuleEventDispatcher::class);
|
||||
return $dispatcher instanceof ModuleEventDispatcher ? $dispatcher : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private function createAuthSessionTenantContextService(): AuthSessionTenantContextService
|
||||
{
|
||||
return $this->authSessionTenantContextService ??= new AuthSessionTenantContextService(
|
||||
|
||||
Reference in New Issue
Block a user