Fix use login for User homedir in LDAP

posixAccount objectclass (intended to be used with the uid/gid/homedir fields) requires a homedir.
Always set a homedir in LDAP for the User class even if user does not have a firstname by using the login instead.
Additionally on Linux the login is typically used for the home directory rather than the first name.
It also avoids having accentuated or other special characters (commonly found in names) in the home directory path.
This commit is contained in:
piernov 2021-05-15 16:48:43 +02:00
parent 014b34acc6
commit beff175de1
No known key found for this signature in database
GPG Key ID: 46A3C65C574D3CDA

View File

@ -2689,7 +2689,7 @@ class User extends CommonObject
}
}
}
if (!empty($this->firstname) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->firstname";
if (!empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login";
return $info;
}