diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-04-22 12:22:07 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-04-22 12:22:07 +0200 |
commit | 8a46e809f00745f4b67d118e85ec2d35e74b732e (patch) | |
tree | 324da0b930d7857e71ae96dcbf0bb060cdfa6db2 /apps/files_encryption/hooks | |
parent | 8790ceba25ab3a7ae3359037981c0019e229160a (diff) | |
download | nextcloud-server-8a46e809f00745f4b67d118e85ec2d35e74b732e.tar.gz nextcloud-server-8a46e809f00745f4b67d118e85ec2d35e74b732e.zip |
remove util::getPaths(), this function was broken and is replaced my util::getAllFiles(). When unsharing a folder only remove the share key for sub files if the user really no longer have access to the file. Can happen that a sub-file/-folder is shared to a group the user is a member of or explicitly once more to the same user
Diffstat (limited to 'apps/files_encryption/hooks')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 13cf352b4ed..e3861e7cc5a 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -196,7 +196,6 @@ class Hooks { $sharingEnabled = \OCP\Share::isEnabled();
if ($params['itemType'] === 'folder') {
- //list($owner, $ownerPath) = $util->getUidAndFilename($filePath);
$allFiles = $util->getAllFiles($path);
} else {
$allFiles = array($path);
@@ -250,13 +249,21 @@ class Hooks { $userIds = array($params['shareWith']);
}
- // If path is a folder, get all children
- $allPaths = $util->getPaths( $path );
-
- foreach ( $allPaths as $path ) {
+ if ($params['itemType'] === 'folder') {
+ $allFiles = $util->getAllFiles($path);
+ } else {
+ $allFiles = array($path);
+ }
+
- // Unshare each child path
- if ( ! Keymanager::delShareKey( $view, $userIds, $path ) ) {
+ foreach ( $allFiles as $path ) {
+
+ // check if the user still has access to the file, otherwise delete share key
+ $sharingUsers = $util->getSharingUsersArray(true, $path);
+
+ // Unshare every user who no longer has access to the file
+ $delUsers = array_diff($userIds, $sharingUsers);
+ if ( ! Keymanager::delShareKey( $view, $delUsers, $path ) ) {
$failed[] = $path;
|