diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 16:46:45 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 16:46:45 +0200 |
commit | 1fbf5d86df7ba4001ca826d9dfb8fad073924fde (patch) | |
tree | 9260b35011fabbbf69747419282d193fa7a9089c /lib/private/encryption/update.php | |
parent | 2182ae0d278f466e7f117b03bf4ebca0e6e9fe9b (diff) | |
parent | 2d2cb09715554926945de29b80f033905a219abd (diff) | |
download | nextcloud-server-1fbf5d86df7ba4001ca826d9dfb8fad073924fde.tar.gz nextcloud-server-1fbf5d86df7ba4001ca826d9dfb8fad073924fde.zip |
Merge pull request #14472 from owncloud/feature/wipencryptionapp
encryption 2.0 app
Diffstat (limited to 'lib/private/encryption/update.php')
-rw-r--r-- | lib/private/encryption/update.php | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/lib/private/encryption/update.php b/lib/private/encryption/update.php index 06dc330151e..1cfe935e584 100644 --- a/lib/private/encryption/update.php +++ b/lib/private/encryption/update.php @@ -46,12 +46,16 @@ class Update { /** @var string */ protected $uid; + /** @var \OC\Encryption\File */ + protected $file; + /** * * @param \OC\Files\View $view * @param \OC\Encryption\Util $util * @param \OC\Files\Mount\Manager $mountManager * @param \OC\Encryption\Manager $encryptionManager + * @param \OC\Encryption\File $file * @param string $uid */ public function __construct( @@ -59,6 +63,7 @@ class Update { Util $util, Mount\Manager $mountManager, Manager $encryptionManager, + File $file, $uid ) { @@ -66,6 +71,7 @@ class Update { $this->util = $util; $this->mountManager = $mountManager; $this->encryptionManager = $encryptionManager; + $this->file = $file; $this->uid = $uid; } @@ -87,25 +93,29 @@ class Update { * @param int $fileSource file source id */ private function update($fileSource) { - $path = \OC\Files\Filesystem::getPath($fileSource); - $absPath = '/' . $this->uid . '/files' . $path; - - $mount = $this->mountManager->find($path); - $mountPoint = $mount->getMountPoint(); - - // if a folder was shared, get a list of all (sub-)folders - if ($this->view->is_dir($absPath)) { - $allFiles = $this->util->getAllFiles($absPath, $mountPoint); - } else { - $allFiles = array($absPath); - } + $path = \OC\Files\Filesystem::getPath($fileSource); + $info = \OC\Files\Filesystem::getFileInfo($path); + $owner = \OC\Files\Filesystem::getOwner($path); + $view = new \OC\Files\View('/' . $owner . '/files'); + $ownerPath = $view->getPath($info->getId()); + $absPath = '/' . $owner . '/files' . $ownerPath; + + $mount = $this->mountManager->find($path); + $mountPoint = $mount->getMountPoint(); + + // if a folder was shared, get a list of all (sub-)folders + if ($this->view->is_dir($absPath)) { + $allFiles = $this->util->getAllFiles($absPath, $mountPoint); + } else { + $allFiles = array($absPath); + } - $encryptionModule = $this->encryptionManager->getDefaultEncryptionModule(); + $encryptionModule = $this->encryptionManager->getDefaultEncryptionModule(); - foreach ($allFiles as $path) { - $usersSharing = $this->util->getSharingUsersArray($path); - $encryptionModule->update($absPath, $this->uid, $usersSharing); - } + foreach ($allFiles as $path) { + $usersSharing = $this->file->getAccessList($path); + $encryptionModule->update($path, $this->uid, $usersSharing); + } } -}
\ No newline at end of file +} |