mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-23 21:03:05 +08:00
Merge branch 'master' of https://github.com/jasonhoule/BookStack into jasonhoule-master
This commit is contained in:
commit
85db812fea
|
@ -115,6 +115,16 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
|
|||
'password' => Str::random(32),
|
||||
];
|
||||
|
||||
return $this->registrationService->registerUser($details, null, false);
|
||||
$user = $this->registrationService->registerUser($details, null, false);
|
||||
|
||||
if (config('services.ldap.import_thumbnail_photos')) {
|
||||
$imageService = app()->make(ImageService::class);
|
||||
$image = $imageService->saveNewFromBase64Uri('data:image/jpg;base64,'.base64_encode($ldapUserDetails['avatar']), $ldapUserDetails['uid'].'.jpg', 'user');
|
||||
|
||||
$user['image_id'] = $image->id;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ class LdapService extends ExternalAuthService
|
|||
$idAttr = $this->config['id_attribute'];
|
||||
$emailAttr = $this->config['email_attribute'];
|
||||
$displayNameAttr = $this->config['display_name_attribute'];
|
||||
$thumbnailAttr = $this->config['thumbnail_attribute'];
|
||||
|
||||
$user = $this->getUserWithAttributes($userName, ['cn', 'dn', $idAttr, $emailAttr, $displayNameAttr]);
|
||||
|
||||
|
@ -89,6 +90,7 @@ class LdapService extends ExternalAuthService
|
|||
'name' => $this->getUserResponseProperty($user, $displayNameAttr, $userCn),
|
||||
'dn' => $user['dn'],
|
||||
'email' => $this->getUserResponseProperty($user, $emailAttr, null),
|
||||
'avatar'=> $this->getUserResponseProperty($user, $thumbnailAttr, null),
|
||||
];
|
||||
|
||||
if ($this->config['dump_user_details']) {
|
||||
|
|
|
@ -133,6 +133,8 @@ return [
|
|||
'remove_from_groups' => env('LDAP_REMOVE_FROM_GROUPS', false),
|
||||
'tls_insecure' => env('LDAP_TLS_INSECURE', false),
|
||||
'start_tls' => env('LDAP_START_TLS', false),
|
||||
'import_thumbnail_photos' => env('LDAP_IMPORT_THUMBNAIL_PHOTOS', false),
|
||||
'thumbnail_attribute' => env('LDAP_THUMBNAIL_ATTRIBUTE', 'thumbnailPhoto'),
|
||||
],
|
||||
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue
Block a user