diff options
author | Sam Tuke <samtuke@owncloud.com> | 2013-05-09 14:43:06 +0200 |
---|---|---|
committer | Sam Tuke <samtuke@owncloud.com> | 2013-05-09 14:43:06 +0200 |
commit | 101e037529fef0273ba9d4de522d2e47d8a6ef0b (patch) | |
tree | 07aaf28d1cf7563d2df6d1ac20d6fde23ee8333d /apps/files_encryption/hooks | |
parent | 28866de44bbf5c5bc2b1e0689b5139047ba5273b (diff) | |
download | nextcloud-server-101e037529fef0273ba9d4de522d2e47d8a6ef0b.tar.gz nextcloud-server-101e037529fef0273ba9d4de522d2e47d8a6ef0b.zip |
Fixed bugs with pre_share hook usage
Made sure new user being shared to is added to array of sharing users
Diffstat (limited to 'apps/files_encryption/hooks')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 1f642f48415..e8cd4ade713 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -277,21 +277,28 @@ class Hooks { // if a folder was shared, get a list if all (sub-)folders
if ( $params['itemType'] === 'folder' ) {
- $allFiles = $util->getAllFiles($path);
+
+ $allFiles = $util->getAllFiles( $path );
+
} else {
$allFiles = array( $path );
}
+
+ // Set array for collecting paths which can't be shared
+ $failed = array();
foreach ( $allFiles as $path ) {
$usersSharing = $util->getSharingUsersArray( $sharingEnabled, $path );
-
- $failed = array();
+
+ // Because this is a pre_share hook, the user
+ // being shared to is not yet included; add them
+ $usersSharing[] = $params['shareWith'];
// Attempt to set shareKey
- if ( !$util->setSharedFileKeyfiles( $session, $usersSharing, $path ) ) {
+ if ( ! $util->setSharedFileKeyfiles( $session, $usersSharing, $path ) ) {
$failed[] = $path;
}
@@ -304,6 +311,9 @@ class Hooks { // script that hook execution failed
$params['run']->run = false;
+ // TODO: Make sure files_sharing provides user
+ // feedback on failed share
+
}
}
}
|