diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-02 16:25:01 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 13:30:31 +0200 |
commit | fe74a0cb4f319ac9dccfce8c296365c3535ef84e (patch) | |
tree | df5c6034c6722c5687ce6f9c7415d4b8adf8d445 /lib/private/encryption/keys | |
parent | 8991272269632bc094fb8ad537d5af5a1bc372b5 (diff) | |
download | nextcloud-server-fe74a0cb4f319ac9dccfce8c296365c3535ef84e.tar.gz nextcloud-server-fe74a0cb4f319ac9dccfce8c296365c3535ef84e.zip |
implement webdav copy
Diffstat (limited to 'lib/private/encryption/keys')
-rw-r--r-- | lib/private/encryption/keys/storage.php | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/private/encryption/keys/storage.php b/lib/private/encryption/keys/storage.php index e4e3fb084f3..7d0612ae30e 100644 --- a/lib/private/encryption/keys/storage.php +++ b/lib/private/encryption/keys/storage.php @@ -283,7 +283,12 @@ class Storage implements \OCP\Encryption\Keys\IStorage { * @param string $owner * @param bool $systemWide */ - public function renameKeys($source, $target, $owner, $systemWide) { + public function renameKeys($source, $target) { + + list($owner, $source) = $this->util->getUidAndFilename($source); + list(, $target) = $this->util->getUidAndFilename($target); + $systemWide = $this->util->isSystemWideMountPoint($target); + if ($systemWide) { $sourcePath = $this->keys_base_dir . $source . '/'; $targetPath = $this->keys_base_dir . $target . '/'; @@ -299,6 +304,34 @@ class Storage implements \OCP\Encryption\Keys\IStorage { } /** + * copy keys if a file was renamed + * + * @param string $source + * @param string $target + * @param string $owner + * @param bool $systemWide + */ + public function copyKeys($source, $target) { + + list($owner, $source) = $this->util->getUidAndFilename($source); + list(, $target) = $this->util->getUidAndFilename($target); + $systemWide = $this->util->isSystemWideMountPoint($target); + + if ($systemWide) { + $sourcePath = $this->keys_base_dir . $source . '/'; + $targetPath = $this->keys_base_dir . $target . '/'; + } else { + $sourcePath = '/' . $owner . $this->keys_base_dir . $source . '/'; + $targetPath = '/' . $owner . $this->keys_base_dir . $target . '/'; + } + + if ($this->view->file_exists($sourcePath)) { + $this->keySetPreparation(dirname($targetPath)); + $this->view->copy($sourcePath, $targetPath); + } + } + + /** * Make preparations to filesystem for saving a keyfile * * @param string $path relative to the views root |