Exemplo n.º 1
0
 /**
  * Synchronize user profile
  *
  * @access public
  * @param  UserProviderInterface $user
  * @return array
  */
 public function synchronize(UserProviderInterface $user)
 {
     $profile = $this->user->getByExternalId($user->getExternalIdColumn(), $user->getExternalId());
     $properties = UserProperty::getProperties($user);
     if (!empty($profile)) {
         $profile = $this->updateUser($profile, $properties);
     } elseif ($user->isUserCreationAllowed()) {
         $profile = $this->createUser($user, $properties);
     }
     return $profile;
 }
Exemplo n.º 2
0
 /**
  * Synchronize user properties with the local database and create the user session
  *
  * @access public
  * @param  UserProviderInterface $user
  * @return boolean
  */
 public function initialize(UserProviderInterface $user)
 {
     if ($user->getInternalId()) {
         $profile = $this->user->getById($user->getInternalId());
     } elseif ($user->getExternalIdColumn() && $user->getExternalId()) {
         $profile = $this->userSync->synchronize($user);
         $this->groupSync->synchronize($profile['id'], $user->getExternalGroupIds());
     }
     if (!empty($profile) && $profile['is_active'] == 1) {
         $this->userSession->initialize($profile);
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Synchronize user properties with the local database and create the user session
  *
  * @access public
  * @param  UserProviderInterface $user
  * @return boolean
  */
 public function initialize(UserProviderInterface $user)
 {
     if ($user->getInternalId()) {
         $profile = $this->user->getById($user->getInternalId());
     } elseif ($user->getExternalIdColumn() && $user->getExternalId()) {
         $profile = $this->userSync->synchronize($user);
         $this->groupSync->synchronize($profile['id'], $user->getExternalGroupIds());
     }
     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;
     }
     return false;
 }