From 24993280edcf66f9daa5a5e82428fefef4a3ab56 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 4 Dec 2014 19:51:04 +0100 Subject: Next step in server-to-server sharing next generation, see #12285 Beside some small improvements and bug fixes this will probably the final state for OC8. To test this you need to set up two ownCloud instances. Let's say: URL: myPC/firstOwnCloud user: user1 URL: myPC/secondOwnCloud user: user2 Now user1 can share a file with user2 by entering the username and the URL to the second ownCloud to the share-drop-down, in this case "user2@myPC/secondOwnCloud". The next time user2 login he will get a notification that he received a server-to-server share with the option to accept/decline it. If he accept it the share will be mounted. In both cases a event will be send back to user1 and add a notification to the activity stream that the share was accepted/declined. If user1 decides to unshare the file again from user2 the share will automatically be removed from the second ownCloud server and user2 will see a notification in his activity stream that user1@myPC/firstOwnCloud has unshared the file/folder from him. --- apps/files_encryption/lib/hooks.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'apps/files_encryption/lib/hooks.php') diff --git a/apps/files_encryption/lib/hooks.php b/apps/files_encryption/lib/hooks.php index bddfb7b2544..7ddde0a3112 100644 --- a/apps/files_encryption/lib/hooks.php +++ b/apps/files_encryption/lib/hooks.php @@ -25,8 +25,6 @@ namespace OCA\Files_Encryption; -use OC\Files\Filesystem; - /** * Class for hook specific logic */ @@ -364,15 +362,16 @@ class Hooks { if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { $view = new \OC\Files\View('/'); - $userId = \OCP\User::getUser(); + $userId = $params['uidOwner']; + $userView = new \OC\Files\View('/' . $userId . '/files'); $util = new Util($view, $userId); - $path = \OC\Files\Filesystem::getPath($params['fileSource']); + $path = $userView->getPath($params['fileSource']); // for group shares get a list of the group members if ($params['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) { $userIds = \OC_Group::usersInGroup($params['shareWith']); } else { - if ($params['shareType'] === \OCP\Share::SHARE_TYPE_LINK) { + if ($params['shareType'] === \OCP\Share::SHARE_TYPE_LINK || $params['shareType'] === \OCP\Share::SHARE_TYPE_REMOTE) { $userIds = array($util->getPublicShareKeyId()); } else { $userIds = array($params['shareWith']); @@ -619,8 +618,8 @@ class Hooks { // check if the user still has access to the file, otherwise delete share key $sharingUsers = \OCP\Share::getUsersSharingFile($path, $user); - if (!in_array(\OCP\User::getUser(), $sharingUsers['users'])) { - Keymanager::delShareKey($view, array(\OCP\User::getUser()), $keyPath, $owner, $ownerPath); + if (!in_array($user, $sharingUsers['users'])) { + Keymanager::delShareKey($view, array($user), $keyPath, $owner, $ownerPath); } } -- cgit v1.2.3