Create identity for each email address of a new user

This commit is contained in:
Aleksander Machniak 2012-10-08 11:32:49 +02:00
parent a7c06ff2fd
commit bde912a1fe
3 changed files with 14 additions and 7 deletions

View file

@ -11,8 +11,9 @@ $rcmail_config['kolab_auth_filter'] = '(&(objectClass=kolabInetOrgPerson)(|(uid=
$rcmail_config['kolab_auth_login'] = 'email';
// Use this fields (from fieldmap configuration) for default identity.
// Note: These aren't LDAP attributes, but field names in config
// If the value array contains more than one field, first non-empty will be used
// Note: These aren't LDAP attributes, but field names in config
// Note: If there's more than one email address, as many identities will be created
$rcmail_config['kolab_auth_name'] = array('name', 'cn');
$rcmail_config['kolab_auth_email'] = array('email');

View file

@ -206,8 +206,15 @@ class kolab_auth extends rcube_plugin
public function user_create($args)
{
if (!empty($this->data['user_email'])) {
$args['user_email'] = $this->data['user_email'];
// addresses list is supported
if (array_key_exists('email_list', $args)) {
$args['email_list'] = array_unique($this->data['user_email']);
}
else {
$args['user_email'] = $this->data['user_email'][0];
}
}
if (!empty($this->data['user_name'])) {
$args['user_name'] = $this->data['user_name'];
}
@ -374,12 +381,11 @@ class kolab_auth extends rcube_plugin
break;
}
}
// User email for identity (first log in)
// User email(s) for identity (first log in)
foreach ((array)$email_attr as $field) {
$email = is_array($record[$field]) ? $record[$field][0] : $record[$field];
$email = is_array($record[$field]) ? array_filter($record[$field]) : $record[$field];
if (!empty($email)) {
$this->data['user_email'] = $email;
break;
$this->data['user_email'] = array_merge((array)$this->data['user_email'], (array)$email);
}
}

View file

@ -20,7 +20,7 @@
</lead>
<date>2012-10-08</date>
<version>
<release>0.3</release>
<release>0.4</release>
<api>0.1</api>
</version>
<stability>