From 300dabe6b4e9e648c1111363fad8154def7cfb5f Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 7 May 2016 12:59:35 -0400 Subject: Added support for LDAP user photo profile --- app/Subscriber/BaseSubscriber.php | 1 - app/Subscriber/LdapUserPhotoSubscriber.php | 49 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 app/Subscriber/LdapUserPhotoSubscriber.php (limited to 'app/Subscriber') diff --git a/app/Subscriber/BaseSubscriber.php b/app/Subscriber/BaseSubscriber.php index 2e41da76..fdea29f6 100644 --- a/app/Subscriber/BaseSubscriber.php +++ b/app/Subscriber/BaseSubscriber.php @@ -34,7 +34,6 @@ class BaseSubscriber extends Base } $this->called[$key] = true; - return false; } } diff --git a/app/Subscriber/LdapUserPhotoSubscriber.php b/app/Subscriber/LdapUserPhotoSubscriber.php new file mode 100644 index 00000000..3cf46077 --- /dev/null +++ b/app/Subscriber/LdapUserPhotoSubscriber.php @@ -0,0 +1,49 @@ + 'syncUserPhoto', + ); + } + + /** + * Save the user profile photo from LDAP to the object storage + * + * @access public + * @param UserProfileSyncEvent $event + */ + public function syncUserPhoto(UserProfileSyncEvent $event) + { + if (is_a($event->getUser(), 'Kanboard\User\LdapUserProvider')) { + $profile = $event->getProfile(); + $photo = $event->getUser()->getPhoto(); + + if (empty($profile['avatar_path']) && ! empty($photo)) { + $this->logger->info('Saving user photo from LDAP profile'); + $this->avatarFile->uploadImageContent($profile['id'], $photo); + } + } + } +} -- cgit v1.2.3