Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c31eddb6 authored by theronakpatel's avatar theronakpatel
Browse files

removed checking str-replace; used ldap instead

parent 79a9ca74
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -194,8 +194,8 @@ class SyncMissingUsersToCommon extends Command {
		// Get user metadata from LDAP
		$userMetadata = $this->ldapConnectionService->getUserMetadata($username);

		// Remove domain from username using UserService
		$usernameWithoutDomain = $this->userService->stripLegacyDomainFromUsername($username);
		// Use usernameWithoutDomain from LDAP metadata
		$usernameWithoutDomain = $userMetadata['usernameWithoutDomain'];

		// Convert LDAP createTimestamp to MySQL datetime format
		$ldapTimestamp = $userMetadata['createTimestamp'] ?? null;
+0 −10
Original line number Diff line number Diff line
@@ -490,14 +490,4 @@ class UserService {
	private function getDefaultQuota() {
		return $this->config->getSystemValueInt('default_quota_in_megabytes', 1024);
	}
	/**
	 * Remove legacy domain from username if present
	 */
	public function stripLegacyDomainFromUsername(string $username): string {
		$legacyDomain = $this->config->getSystemValue('legacy_domain', '');
		if ($legacyDomain && str_ends_with($username, '@' . $legacyDomain)) {
			return substr($username, 0, -strlen('@' . $legacyDomain));
		}
		return $username;
	}
}