roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.94k stars 1.65k forks source link

new_user_identity: Support identity organization field #9105

Open f1-outsourcing opened 1 year ago

f1-outsourcing commented 1 year ago

I have no idea how this plugin should work, or where this is described. I assume this puts entries in the 'identities' table? The ldap log shows it found the 2 records, yet nothing is put in the 'identities' table.

// Determine whether to import user's identities on each login.
// New user identity will be created for each e-mail address
// present in address book, but not assigned to any identity.
$config['new_user_identity_onlogin'] = true;

I would assume that putting this to true, would show me something in the ldap log every time I log in, but that also does not happen. I only get the query when I delete from the users table.

I can't believe this is still not working easily out-of-the-box.

Roundcube Webmail 1.6.2, new_user_identity 1.2

f1-outsourcing commented 1 year ago

Ok tested with 1 record now something is changing. So having multiple search results makes this plugin fail. I would say that is bad, because this is the responsibility of the user to make sure he formats correct ldap filters. Besides that it is perfectly normal to have multiple results.

f1-outsourcing commented 1 year ago

Plugin does not seem to set the organization field

f1-outsourcing commented 1 year ago

For allowing multiple results:

 38             if (count($results->records) >= 1) {

I tried adding organization with this, but I don't really see where this identity is being set when the user is created


     41                 $user_email = is_array($user['email']) ? $user['email'][0] : $user['email'];
     42                 $user_organization = is_array($user['organization']) ? $user['organization'][0] : $user['organization'];
     43
     44                 $args['user_name']  = $user_name;
     45                 $args['email_list'] = [''];
     46                 $args['organization'] = $user_organization;
f1-outsourcing commented 1 year ago

For the organization to be set this file needs to be patched

program/lib/Roundcube/rcube_user.php

    674             $user_email  = $data['user_email'];
    675             $email_list  = $data['email_list'];
    676             $organization  = $data['organization'];

and here

    712                 $record['user_id']  = $user_id;
    713                 $record['standard'] = $standard;
    714                 $record['organization'] = $organization;
f1-outsourcing commented 1 year ago

Detecting the multiple identities, email addresses still fails though

alecpl commented 1 year ago

Having multiple LDAP records for the same user is not supported scenario.

I suppose we could add support for organization attribute.

f1-outsourcing commented 1 year ago

What about getting just the first retrieved result as identity, that is better than nothing.