$output->writeln(sprintf(' <comment>Skipping user %s: not on LDAP backend</comment>',$username));
}
return;// Skip this user gracefully
}
// Get user metadata from LDAP
@@ -205,7 +263,10 @@ class SyncMissingUsersToCommon extends Command {
}
}
// Only show detailed output in dry run mode
if($isDryRun){
$output->writeln(sprintf(' Found user in LDAP: %s (created: %s)',$usernameWithoutDomain,$createdAt));
}
if(!$isDryRun){
// Add user to common database
@@ -215,9 +276,16 @@ class SyncMissingUsersToCommon extends Command {
$userMetadata['recoveryMailAddress'],
$createdAt
);
// Only show success message in dry run mode for performance
if($isDryRun){
$output->writeln(sprintf(' <info>✓ User synced successfully to common database: %s</info>',$usernameWithoutDomain));
}
}else{
$output->writeln(sprintf(' <comment>Would sync user to common database with recovery email: %s and created_at: %s</comment>',$userMetadata['recoveryMailAddress'],$createdAt));
}
}catch(Exception$e){
// Re-throw the exception to be caught by the caller
thrownewException(sprintf("Failed to sync user %s: %s",$username,$e->getMessage()),0,$e);