Fix delegatee deletion if configured field name equals attribute name
Fix so delegate field name might be omitted in kolab_auth plugin config (#3400)
This commit is contained in:
parent
824db716b4
commit
e4100366b5
2 changed files with 18 additions and 2 deletions
|
@ -202,7 +202,9 @@ class kolab_auth_ldap extends rcube_ldap_generic
|
|||
foreach ($this->fieldmap as $field => $attr) {
|
||||
if (array_key_exists($field, $entry)) {
|
||||
$entry[$attr] = $entry[$field];
|
||||
unset($entry[$field]);
|
||||
if ($attr != $field) {
|
||||
unset($entry[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,6 +510,19 @@ class kolab_auth_ldap extends rcube_ldap_generic
|
|||
return $this->parse_replaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional fields
|
||||
*/
|
||||
public function extend_fieldmap($map)
|
||||
{
|
||||
foreach ((array)$map as $name => $attr) {
|
||||
if (!in_array($attr, $this->attributes)) {
|
||||
$this->attributes[] = $attr;
|
||||
$this->fieldmap[$name] = $attr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HTML-safe DN string encoding
|
||||
*
|
||||
|
|
|
@ -240,6 +240,7 @@ class kolab_delegation_engine
|
|||
$this->ldap_org_field = $this->rc->config->get('kolab_auth_organization');
|
||||
|
||||
$ldap->set_filter($this->ldap_filter);
|
||||
$ldap->extend_fieldmap(array($this->ldap_delegate_field => $this->ldap_delegate_field));
|
||||
|
||||
return $ldap;
|
||||
}
|
||||
|
@ -533,7 +534,7 @@ class kolab_delegation_engine
|
|||
}
|
||||
|
||||
// Get current user record
|
||||
$this->cache['user'] = $ldap->get_record($this->ldap_dn, true);
|
||||
$this->cache['user'] = $ldap->get_record($this->ldap_dn);
|
||||
}
|
||||
|
||||
return $parsed ? $this->parse_ldap_record($this->cache['user']) : $this->cache['user'];
|
||||
|
|
Loading…
Add table
Reference in a new issue