mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-28 13:12:05 +00:00
Issue #1306 - Specify display name attribute from LDAP
This commit is contained in:
parent
33e999909f
commit
55b07c7076
@ -80,7 +80,9 @@ class LdapService
|
|||||||
public function getUserDetails($userName)
|
public function getUserDetails($userName)
|
||||||
{
|
{
|
||||||
$emailAttr = $this->config['email_attribute'];
|
$emailAttr = $this->config['email_attribute'];
|
||||||
$user = $this->getUserWithAttributes($userName, ['cn', 'uid', 'dn', $emailAttr]);
|
$displayNameAttr = $this->config['display_name_attribute'];
|
||||||
|
|
||||||
|
$user = $this->getUserWithAttributes($userName, ['cn', 'uid', 'dn', $emailAttr, $displayNameAttr]);
|
||||||
|
|
||||||
if ($user === null) {
|
if ($user === null) {
|
||||||
return null;
|
return null;
|
||||||
@ -88,7 +90,7 @@ class LdapService
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'uid' => (isset($user['uid'])) ? $user['uid'][0] : $user['dn'],
|
'uid' => (isset($user['uid'])) ? $user['uid'][0] : $user['dn'],
|
||||||
'name' => $user['cn'][0],
|
'name' => (isset($uset[$displayNameAttr])) ? (is_array($user[$displayNameAttr]) ? $user[$displayNameAttr][0] : $user[$displayNameAttr]) : $user['cn'][0],
|
||||||
'dn' => $user['dn'],
|
'dn' => $user['dn'],
|
||||||
'email' => (isset($user[$emailAttr])) ? (is_array($user[$emailAttr]) ? $user[$emailAttr][0] : $user[$emailAttr]) : null
|
'email' => (isset($user[$emailAttr])) ? (is_array($user[$emailAttr]) ? $user[$emailAttr][0] : $user[$emailAttr]) : null
|
||||||
];
|
];
|
||||||
|
@ -141,6 +141,7 @@ return [
|
|||||||
'user_filter' => env('LDAP_USER_FILTER', '(&(uid=${user}))'),
|
'user_filter' => env('LDAP_USER_FILTER', '(&(uid=${user}))'),
|
||||||
'version' => env('LDAP_VERSION', false),
|
'version' => env('LDAP_VERSION', false),
|
||||||
'email_attribute' => env('LDAP_EMAIL_ATTRIBUTE', 'mail'),
|
'email_attribute' => env('LDAP_EMAIL_ATTRIBUTE', 'mail'),
|
||||||
|
'display_name_attribute' => env('LDAP_DISPLAY_NAME_ATTRIBUTE', 'cn'),
|
||||||
'follow_referrals' => env('LDAP_FOLLOW_REFERRALS', false),
|
'follow_referrals' => env('LDAP_FOLLOW_REFERRALS', false),
|
||||||
'user_to_groups' => env('LDAP_USER_TO_GROUPS',false),
|
'user_to_groups' => env('LDAP_USER_TO_GROUPS',false),
|
||||||
'group_attribute' => env('LDAP_GROUP_ATTRIBUTE', 'memberOf'),
|
'group_attribute' => env('LDAP_GROUP_ATTRIBUTE', 'memberOf'),
|
||||||
|
Loading…
Reference in New Issue
Block a user