diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-02-13 14:56:39 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-02-13 14:56:39 +0100 |
commit | 4952dfe95657ba52f1b39f958100659539831ba8 (patch) | |
tree | 6bde1adb4eb343d64af0d3c919e3a71a4e88dfe2 /apps/files_encryption | |
parent | a692264fa416fec44d774bd955a06a65c7c0d158 (diff) | |
download | nextcloud-server-4952dfe95657ba52f1b39f958100659539831ba8.tar.gz nextcloud-server-4952dfe95657ba52f1b39f958100659539831ba8.zip |
add post_unshare hook, also add public link shares to the list of user with access to a file
Diffstat (limited to 'apps/files_encryption')
-rw-r--r-- | apps/files_encryption/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 9 | ||||
-rwxr-xr-x | apps/files_encryption/lib/crypt.php | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index f83109a18ea..932e8855d07 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -16,7 +16,7 @@ OCP\Util::connectHook( 'OC_User', 'pre_setPassword','OCA\Encryption\Hooks', 'set // Sharing-related hooks OCP\Util::connectHook( 'OCP\Share', 'post_shared', 'OCA\Encryption\Hooks', 'postShared' ); -OCP\Util::connectHook( 'OCP\Share', 'pre_unshare', 'OCA\Encryption\Hooks', 'preUnshare' ); +OCP\Util::connectHook( 'OCP\Share', 'post_unshare', 'OCA\Encryption\Hooks', 'postUnshare' ); OCP\Util::connectHook( 'OCP\Share', 'pre_unshareAll', 'OCA\Encryption\Hooks', 'preUnshareAll' ); // Webdav-related hooks diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 5e06948aa50..ae05ba78012 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -176,6 +176,8 @@ class Hooks { //TODO: We don't deal with shared folder yet, need to recursively update every file in the folder
+ if ($params['shareType'] == \OCP\Share::SHARE_TYPE_LINK)
+
$view = new \OC_FilesystemView( '/' );
$userId = \OCP\User::getUser();
$util = new Util( $view, $userId );
@@ -191,12 +193,9 @@ class Hooks { /**
* @brief
*/
- public static function preUnshare( $params ) {
-
+ public static function postUnshare( $params ) {
$path = Util::getFilePath($params['itemSource']);
- $shares = \OCP\Share::getUsersSharingFile( $path, true, false );
- // remove the user from the list from which the file will be unshared
- unset($shares[$params['shareWith']]);
+ $shares = \OCP\Share::getUsersSharingFile( $path, true );
return Crypt::encKeyfileToMultipleUsers(array_unique($shares), $path );
}
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index ba9f0cb9a2a..0f465d7d95a 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -450,7 +450,9 @@ class Crypt { * @returns encrypted file
*/
public static function keyEncrypt( $plainContent, $publicKey ) {
- openssl_public_encrypt( $plainContent, $encryptedContent, $publicKey );
+
+ if (openssl_public_encrypt( $plainContent, $encryptedContent, $publicKey )) error_log("feinifeine"); else error_log("ups");
+
return $encryptedContent;
}
|