diff options
Diffstat (limited to 'app/Core/User/UserProfile.php')
-rw-r--r-- | app/Core/User/UserProfile.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/Core/User/UserProfile.php b/app/Core/User/UserProfile.php index ef325801..8b9ebb71 100644 --- a/app/Core/User/UserProfile.php +++ b/app/Core/User/UserProfile.php @@ -3,6 +3,7 @@ namespace Kanboard\Core\User; use Kanboard\Core\Base; +use Kanboard\Event\UserProfileSyncEvent; /** * User Profile @@ -12,6 +13,8 @@ use Kanboard\Core\Base; */ class UserProfile extends Base { + const EVENT_USER_PROFILE_AFTER_SYNC = 'user_profile.after.sync'; + /** * Assign provider data to the local user * @@ -22,12 +25,12 @@ class UserProfile extends Base */ public function assign($userId, UserProviderInterface $user) { - $profile = $this->user->getById($userId); + $profile = $this->userModel->getById($userId); $values = UserProperty::filterProperties($profile, UserProperty::getProperties($user)); $values['id'] = $userId; - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $profile = array_merge($profile, $values); $this->userSession->initialize($profile); return true; @@ -46,7 +49,7 @@ class UserProfile extends Base public function initialize(UserProviderInterface $user) { if ($user->getInternalId()) { - $profile = $this->user->getById($user->getInternalId()); + $profile = $this->userModel->getById($user->getInternalId()); } elseif ($user->getExternalIdColumn() && $user->getExternalId()) { $profile = $this->userSync->synchronize($user); $this->groupSync->synchronize($profile['id'], $user->getExternalGroupIds()); @@ -54,6 +57,7 @@ class UserProfile extends Base if (! empty($profile) && $profile['is_active'] == 1) { $this->userSession->initialize($profile); + $this->dispatcher->dispatch(self::EVENT_USER_PROFILE_AFTER_SYNC, new UserProfileSyncEvent($profile, $user)); return true; } |