Author Topic: Display Name from LDAP  (Read 5608 times)

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Display Name from LDAP
« on: November 02, 2023, 01:34:48 PM »
Hi!
It is possible to fill field Display Name in identities from LDAP ?
May be config options or another way ?

PS.
Now I just think -  I can write script who take Display Name from AD and post it to MariaDB users settings table, but I hope exist some better and easy way.

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: Display Name from LDAP
« Reply #1 on: November 03, 2023, 02:29:54 AM »
Check new_user_identity plugin.

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: Display Name from LDAP
« Reply #2 on: November 03, 2023, 09:16:08 AM »
Looks like that I want!
Thank you!

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: Display Name from LDAP
« Reply #3 on: November 03, 2023, 09:44:50 AM »
im not clearly understand config file and need explanation:

1.
Quote
// 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.)
$config['new_user_identity_addressbook'] = 'ldap_users';

Here I must use my address book name from my RC config ?

2.
Quote
// When automatically setting a user's full name in their
// new identity, match the user's login name against this field.
$config['new_user_identity_match'] = 'uid';

This I can't understand. For example I take from AD to my address book this fields:
'name'   => 'displayname',
'email'   => 'mail'

and for login my users use full mail like user@domain.com. Should I use 'email' ? $config['new_user_identity_match'] = 'email';
And what field from address book will be used for filling identities ?

3.
Quote
// 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'] = false;

If I set it to TRUE then users identities will be rewrite from LDAP every time when user login or what ?

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: Display Name from LDAP
« Reply #4 on: November 16, 2023, 12:12:52 PM »
I setup like this:

Quote
$config['new_user_identity_addressbook'] = 'ldap_users';
$config['new_user_identity_match'] = 'email';
$config['new_user_identity_onlogin'] = true;

Quote
$config['ldap_public'] = [
  'ldap_users' => [
                        ......................
                        'search_fields'         =>['displayname','mail'],
                        'fieldmap'              => [
                                                        'name'  => 'displayname',
                                                        'email' => 'mail'
                         ],
                        ......................
        ],

But stilll when I login - users identity not update from AD. Can't understand how I can debug this or what I do wrong ?

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: Display Name from LDAP
« Reply #5 on: November 17, 2023, 01:28:15 AM »

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: Display Name from LDAP
« Reply #6 on: November 19, 2023, 06:41:22 AM »
Thank you!
Now its working!