Esempio n. 1
0
 /**
  * @param \OC\Files\View $view
  * @param string $userId
  * @param bool $client
  */
 public function __construct($view, $userId, $client = false)
 {
     $this->view = $view;
     $this->client = $client;
     $this->userId = $userId;
     $appConfig = \OC::$server->getAppConfig();
     $this->publicShareKeyId = $appConfig->getValue('files_encryption', 'publicShareKeyId');
     $this->recoveryKeyId = $appConfig->getValue('files_encryption', 'recoveryKeyId');
     $this->userDir = '/' . $this->userId;
     $this->fileFolderName = 'files';
     $this->userFilesDir = '/' . $userId . '/' . $this->fileFolderName;
     // TODO: Does this need to be user configurable?
     $this->publicKeyDir = Keymanager::getPublicKeyPath();
     $this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
     $this->keysPath = $this->encryptionDir . '/' . 'keys';
     $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.publicKey';
     // e.g. data/public-keys/admin.publicKey
     $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.privateKey';
     // e.g. data/admin/admin.privateKey
     // make sure that the owners home is mounted
     \OC\Files\Filesystem::initMountPoints($userId);
     if (Helper::isPublicAccess()) {
         $this->keyId = $this->publicShareKeyId;
         $this->isPublic = true;
     } else {
         $this->keyId = $this->userId;
         $this->isPublic = false;
     }
 }