예제 #1
0
파일: Remote.php 프로젝트: bolt/Members
 /**
  * {@inheritdoc}
  */
 protected function finish(Request $request)
 {
     parent::finish($request);
     $guid = $this->session->getAuthorisation()->getGuid();
     $avatar = $this->resourceOwner->getAvatar();
     if ($avatar === null) {
         return;
     }
     $metaEntity = $this->records->getAccountMeta($guid, 'avatar') ?: new Entity\AccountMeta(['guid' => $guid, 'meta' => 'avatar']);
     if ($metaEntity->getValue() === null) {
         $metaEntity->setValue($avatar);
         $this->records->saveAccountMeta($metaEntity);
     }
 }
예제 #2
0
파일: Transition.php 프로젝트: bolt/Members
 /**
  * Constructor.
  *
  * @param string                 $guid
  * @param string                 $providerName
  * @param AccessToken            $accessToken
  * @param ResourceOwnerInterface $resourceOwner
  */
 public function __construct($guid, $providerName, AccessToken $accessToken, ResourceOwnerInterface $resourceOwner)
 {
     if (Uuid::isValid($guid) === false) {
         throw new \RuntimeException('Tried to create Transition object with an invalid GUID.');
     }
     $this->guid = $guid;
     $this->accessToken = $accessToken;
     $this->resourceOwner = $resourceOwner;
     $providerEntity = new Entity\Provider();
     $providerEntity->setProvider($providerName);
     $providerEntity->setRefreshToken($accessToken->getRefreshToken());
     $providerEntity->setResourceOwnerId($resourceOwner->getId());
     $providerEntity->setResourceOwner($resourceOwner);
     $this->providerEntity = $providerEntity;
 }
예제 #3
0
 /**
  * Create a new provider entity object.
  *
  * @param AccessToken            $accessToken
  * @param ResourceOwnerInterface $resourceOwner
  */
 protected function createProviderTransition(AccessToken $accessToken, ResourceOwnerInterface $resourceOwner)
 {
     // Create a new provider entry
     $providerName = $this->providerManager->getProviderName();
     // If we have an authorisation, this is for an existing and logged in account,
     // else we either have a new registration or one we need to find an associate.
     $guid = $this->session->getAuthorisation()->getGuid();
     $transition = new Transition($guid, $providerName, $accessToken, $resourceOwner);
     $this->session->addAccessToken($providerName, $accessToken)->setTransitionalProvider($transition);
     $this->setDebugMessage(sprintf('Creating provider profile for %s ID %s', $providerName, $resourceOwner->getId()));
     $this->setDebugMessage(sprintf('Creating provisional %s provider entity for access token %s for ID %s', $providerName, $accessToken, $resourceOwner->getId()));
 }