/**
  * Save the tokens to the registry
  */
 public function connectResponseAction()
 {
     $oAuthTokens = $this->sessionStorageAdapter->read('dropboxTokens');
     $this->dropbox->getOAuth()->setToken($oAuthTokens);
     $oAuthTokens = $this->dropbox->getOAuth()->getAccessToken();
     if (is_array($oAuthTokens)) {
         $this->registry->set('tx_dlDropbox', 'oauth_tokens', $oAuthTokens);
         $this->view->assign('successfullyAuthenticated', true);
     }
 }
 /**
  * action show
  *
  * @return void
  */
 public function showAction()
 {
     /** It seems dropbox ignores the callBackUrl parameters, so the  default controller / action is called */
     if ($this->sessionStorageAdapter->read('dropBoxConnectInProgress')) {
         $this->sessionStorageAdapter->delete('dropBoxConnectInProgress');
         $this->forward('connectResponse', 'OAuth');
     }
     $syncs = $this->syncConfigurationRepository->findAll();
     $this->view->assign('syncs', $syncs);
     $this->view->assign('isAuthenticated', $this->dropbox->isAuthenticated());
 }
Example #3
0
 /**
  * Initialize the object
  */
 public function initializeObject()
 {
     $this->sessionStorageAdapter = Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance();
     $this->registry = t3lib_div::makeInstance('t3lib_Registry');
     $this->initOAuth();
     $this->dropbox = new Dropbox_API($this->oAuth);
 }
 /**
  * Returns a unique instance (Singleton) of the object. Use this method instead of the private/protected class constructor.
  *
  * @param   void
  * @return  Tx_PtExtbase_State_Session_Storage_SessionAdapter      unique instance of the object (Singleton)
  */
 public static function getInstance()
 {
     if (self::$uniqueInstance === null) {
         $className = __CLASS__;
         self::$uniqueInstance = new $className();
     }
     return self::$uniqueInstance;
 }
 /** @test */
 public function sessionAdapterCanBeInjectedWithConstructor()
 {
     $sessionAdapter = Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance();
     new Tx_PtExtbase_State_Session_SessionPersistenceManager($sessionAdapter);
 }
 /**
  * Initialize the sessionAdapter
  *
  * @return Tx_PtExtbase_State_Session_Storage_AdapterInterface storageAdapter
  */
 private static function getStorageAdapter()
 {
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtbase_Context')->isInCachedMode()) {
         return Tx_PtExtbase_State_Session_Storage_DBAdapterFactory::getInstance();
     } else {
         return Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance();
     }
 }
 /**
  * @todo If several tree widgets are needed on the same page, provide an identifier and select the right repo from session
  *
  * Restore the repository settings from namespace
  */
 public function restoreTreeSettingsFromSession()
 {
     $settings = Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance()->read('Tx_PtExtbase_Tree_Configuration');
     $settings = array('repository' => 'Tx_PtCertification_Domain_Repository_CategoryRepository', 'namespace' => 'tx_ptcertification_domain_model_category', 'respectEnableFields' => $this->treeContext->respectEnableFields());
     if (array_key_exists('repository', $settings)) {
         $nodeRepositoryClassName = $settings['repository'];
         if ($nodeRepositoryClassName && class_exists($nodeRepositoryClassName)) {
             $this->nodeRepositoryClassName = $nodeRepositoryClassName;
         }
     }
     if (array_key_exists('namespace', $settings)) {
         $this->treeNameSpace = $settings['namespace'];
     }
 }
 /**
  * Read the session data into the cache.
  */
 protected function readFromSession()
 {
     $this->sessionData = $this->sessionAdapter->read('pt_extbase.cached.session');
 }
 /**
  * Save settings to user session
  */
 protected function saveTreeSettingsToSession()
 {
     $treeSettings = array('repository' => $this->arguments['repository'], 'namespace' => $this->arguments['namespace'], 'respectEnableFields' => $this->arguments['respectEnableFields']);
     Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance()->store('Tx_PtExtbase_Tree_Configuration', $treeSettings);
 }
 /**
  * Method determines which session storage adapter to use depending on injected context.
  */
 protected function determineSessionStorageAdapterForGivenContext()
 {
     if ($this->context->isInCachedMode()) {
         return Tx_PtExtbase_State_Session_Storage_DBAdapterFactory::getInstance();
     } else {
         return Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance();
     }
 }