mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-06-09 05:00:21 +00:00
Prevent using undefined or non-existant variables
This commit is contained in:
parent
a50e3eae90
commit
629789612e
@ -627,16 +627,19 @@ function sync_LDAP_groups(){
|
||||
|
||||
foreach ( $mapping as $field => $value ) {
|
||||
dbg_error_log( "LDAP", "Considering copying %s", $field );
|
||||
if ( isset($validUserFields[$field]) ) {
|
||||
if ( isset($validUserFields[$field]) && isset($ldap_values[$value]) ) {
|
||||
$user->{$field} = $ldap_values[$value];
|
||||
dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$value], $value );
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->fullname == "") {
|
||||
// A sane default for the fullname is the group name.
|
||||
if (! isset($user->fullname) || $user->fullname == "") {
|
||||
$user->fullname = $group;
|
||||
}
|
||||
|
||||
// A sane default for the displayname is the fullname (which might be
|
||||
// the group name).
|
||||
if (! isset($user->displayname) || $user->displayname == "") {
|
||||
$user->displayname = $user->fullname;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user