feat(userLifecycle): migrate create_personal_folder() use now on_user_login on_user_created (only if user is not external)

This commit is contained in:
Edouard Vanbelle
2026-06-01 16:05:02 +02:00
parent e130842bfc
commit d81f5dbe48
5 changed files with 209 additions and 138 deletions
+4 -9
View File
@@ -4,7 +4,6 @@ use std::sync::Arc;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
use crate::application::services::auth_application_service::AuthApplicationService;
use crate::application::services::folder_service::FolderService;
use crate::application::services::user_lifecycle_service::UserLifecycleService;
use crate::common::config::AppConfig;
use crate::common::di::AuthServices;
@@ -16,7 +15,6 @@ use crate::infrastructure::services::password_hasher::Argon2PasswordHasher;
pub async fn create_auth_services(
config: &AppConfig,
pool: Arc<PgPool>,
folder_service: Option<Arc<FolderService>>,
user_lifecycle: Arc<UserLifecycleService>,
) -> Result<AuthServices> {
// Create JWT token service (TokenServicePort implementation)
@@ -46,13 +44,10 @@ pub async fn create_auth_services(
config.storage_path.clone(),
);
// Configure folder service if available
if let Some(folder_svc) = folder_service {
auth_app_service = auth_app_service.with_folder_service(folder_svc);
}
// Wire the user-lifecycle dispatcher (carries AuditLifecycleHook today;
// PR 3+ register HomeFolderLifecycleHook, AuthzCacheLifecycleHook, …).
// Wire the user-lifecycle dispatcher. Home-folder provisioning is
// now handled by HomeFolderLifecycleHook (registered on the
// dispatcher in DI) — AuthApplicationService no longer needs a
// direct FolderService dependency for that path.
auth_app_service = auth_app_service.with_user_lifecycle(user_lifecycle);
// Configure OIDC service if enabled