Exemplo n.º 1
0
 public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null)
 {
     if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) {
         $uid = '';
     } else {
         $uid = $user->getUID();
     }
     $credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
     if (is_array($credentials)) {
         $storage->setBackendOption('user', $credentials['user']);
         $storage->setBackendOption('password', $credentials['password']);
     }
 }
Exemplo n.º 2
0
 public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null)
 {
     if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) {
         $uid = '';
     } elseif (is_null($user)) {
         throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
     } else {
         $uid = $user->getUID();
     }
     $credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
     if (is_array($credentials)) {
         $storage->setBackendOption('user', $credentials['user']);
         $storage->setBackendOption('password', $credentials['password']);
     }
 }
Exemplo n.º 3
0
 protected function isApplicable(StorageConfig $config)
 {
     return $config->getApplicableUsers() === [$this->getUser()->getUID()] && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAl;
 }