summaryrefslogtreecommitdiffstats
path: root/lib/private/encryption/keys
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-04-02 16:25:01 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:31 +0200
commitfe74a0cb4f319ac9dccfce8c296365c3535ef84e (patch)
treedf5c6034c6722c5687ce6f9c7415d4b8adf8d445 /lib/private/encryption/keys
parent8991272269632bc094fb8ad537d5af5a1bc372b5 (diff)
downloadnextcloud-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.php35
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