+ $this->groupSyncService->syncUserWithFoundGroups($user, $userLdapGroups, $this->config['remove_from_groups']);
+ }
+
+ /**
+ * Save and attach an avatar image, if found in the ldap details, and attach
+ * to the given user model.
+ */
+ public function saveAndAttachAvatar(User $user, array $ldapUserDetails): void
+ {
+ if (is_null(config('services.ldap.thumbnail_attribute')) || is_null($ldapUserDetails['avatar'])) {
+ return;
+ }
+
+ try {
+ $imageData = $ldapUserDetails['avatar'];
+ $this->userAvatars->assignToUserFromExistingData($user, $imageData, 'jpg');
+ } catch (\Exception $exception) {
+ Log::info("Failed to use avatar image from LDAP data for user id {$user->id}");
+ }