getThumbnailEncoded() public method

Returns the users thumbnail photo base 64 encoded.
public getThumbnailEncoded ( ) : null | string
return null | string
Exemplo n.º 1
0
 /**
  * Handles retrieving the specified field from the User model.
  *
  * @param User   $user
  * @param string $field
  *
  * @return string|null
  */
 protected function handleAttributeRetrieval(User $user, $field)
 {
     if ($field === $this->getSchema()->thumbnail()) {
         // If the field we're retrieving is the users thumbnail photo, we need
         // to retrieve it encoded so we're able to save it to the database.
         $value = $user->getThumbnailEncoded();
     } else {
         $value = $user->{$field};
         // If the AD Value is an array, we'll
         // retrieve the first value.
         $value = is_array($value) ? array_get($value, 0) : $value;
     }
     return $value;
 }
Exemplo n.º 2
0
 /**
  * Create User Entity from adUser
  *
  * @param Models\User $adUser
  *
  * @return null|user
  */
 protected function createUserFromAd(Models\User $adUser)
 {
     $user = new User();
     $user->fullName = $adUser->getDisplayName();
     $user->userName = $adUser->getAccountName();
     $user->email = $adUser->getEmail();
     $user->phone = $adUser->getTelephoneNumber();
     $user->title = $adUser->getTitle();
     $user->thumbnail = $adUser->getThumbnailEncoded();
     // save user
     if ($this->userRepository->save($user)) {
         $userActivity = new UserActivity();
         $userActivity->userId = $user->id;
         $userActivity->type = "createFromAuthDriver";
         $userActivity->description = "Auto create from " . $this->getName();
         $this->userActivityRepository->save($userActivity);
     } else {
         $user = null;
     }
     return $user;
 }
 /**
  * Handles retrieving the specified field from the User model.
  *
  * @param User   $user
  * @param string $field
  *
  * @return string|null
  */
 protected function handleAttributeRetrieval(User $user, $field)
 {
     if ($field === ActiveDirectory::THUMBNAIL) {
         // If the field we're retrieving is the users thumbnail photo, we need
         // to retrieve it encoded so we're able to save it to the database.
         $value = $user->getThumbnailEncoded();
     } else {
         $value = $user->{$field};
         if (is_array($value)) {
             // If the AD Value is an array, we'll
             // retrieve the first value.
             $value = Arr::get($value, 0);
         }
     }
     return $value;
 }
 /**
  * Fills a models attributes by the specified Users attributes.
  *
  * @param User            $user
  * @param Authenticatable $model
  *
  * @return Authenticatable
  */
 protected function syncModelFromAdldap(User $user, Authenticatable $model)
 {
     $attributes = $this->getSyncAttributes();
     foreach ($attributes as $modelField => $adField) {
         if ($adField === ActiveDirectory::THUMBNAIL) {
             // If the field we're retrieving is the users thumbnail photo, we need
             // to retrieve it encoded so we're able to save it to the database.
             $adValue = $user->getThumbnailEncoded();
         } else {
             $adValue = $user->{$adField};
             if (is_array($adValue)) {
                 // If the AD Value is an array, we'll
                 // retrieve the first value.
                 $adValue = Arr::get($adValue, 0);
             }
         }
         $model->{$modelField} = $adValue;
     }
     if ($model instanceof Model) {
         $model->save();
     }
     return $model;
 }