Author Topic: Populate MySql email field with LDAP request  (Read 3757 times)

Offline JMV

  • Newbie
  • *
  • Posts: 7
Populate MySql email field with LDAP request
« on: January 18, 2017, 11:38:09 AM »
Hello,

I would like to customize automatically the email for new users because logins are different than the beginning of email address

for example Robert TRUMP account
Full Name: Robert TRUMP
Mail: robert.trump@mydomain.fr
Login: trump

My data are stored in my LDAP on a different server. Unfortunately, I can't change users login

What solution can I find to customize automatically first part of the email?

Thank you (excuse my poor English)

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Populate MySql email field with LDAP request
« Reply #1 on: January 18, 2017, 12:12:48 PM »
Have you tried the new_user_identity plugin that comes with Roundcube?

Offline JMV

  • Newbie
  • *
  • Posts: 7
Re: Populate MySql email field with LDAP request
« Reply #2 on: January 18, 2017, 12:26:05 PM »
Yes, i tried without suces. The plugin seems not working on my config, when i log a user for the first time roundcube dosen't try to contact annuaire1 (confirmed by tcpdump on annuaire1)

But my public ldap directory works fine on roundcube.


Here a peace of my config


$config['plugins'] = array('acl', 'attachment_reminder', 'filesystem_attachments', 'help', 'jqueryui', 'managesieve', 'markasjunk', 'new_user_identity', 'newmail_notifier', 'password', 'subscriptions_option',);


// Activation logs LDAP
$config['ldap_debug'] = true;

// Definition LDAP
$config['ldap_public']['public'] = array(
    'name'              => 'Carnet adresse ENSASE',
    'hosts'             => array('annuaire1'),
    'port'              => 389,
    'user_specific'     => false,
    'base_dn'           => 'ou=Users,dc=st-etienne,dc=archi,dc=fr',
    'search_fields' => array(
           'mail',
           'cn',
           'DisplayName',
        ),
//      'name_field' => 'cn',
        'name_field' => 'DisplayName',
        'email_field' => 'mail',
        'surname_field' => 'sn',
        'firstname_field' => 'givenName',
        'sort' => 'sn'
);


$config['new_user_identity_addressbook'] = 'cn';
$config['new_user_identity_match'] = 'uid';
$config['new_user_identity_onlogin'] = true;



Thank you

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Populate MySql email field with LDAP request
« Reply #3 on: January 18, 2017, 02:02:32 PM »
It looks like the value of $config['new_user_identity_addressbook'] is incorrect, if you ready the comment above the setting it says:
Code: [Select]
// The id of the address book to use to automatically set a
// user's full name in their new identity. (This should be an
// string, which refers to the $config['ldap_public'] array.)

So to match your ldap config it would need to be 'public'

Offline JMV

  • Newbie
  • *
  • Posts: 7
Re: Populate MySql email field with LDAP request
« Reply #4 on: January 20, 2017, 03:36:06 AM »
Thank you very much, it works now.
Have a good day.