summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-06-28 12:34:04 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-06-29 08:20:19 +0200
commit6cb2cb33ac30226b6165e1da02bb6b6de41e2bbe (patch)
treef016813a28083bf758b5cfc974a24d0c00e4f252 /apps/files_sharing/tests
parent61842f66ee9d5b5ceb5ac925e5c213047d5a5e19 (diff)
downloadnextcloud-server-6cb2cb33ac30226b6165e1da02bb6b6de41e2bbe.tar.gz
nextcloud-server-6cb2cb33ac30226b6165e1da02bb6b6de41e2bbe.zip
Fix getting the information of group share as a sharee
When the receiver of a group share modifies it (for example, by moving it to a different folder) the original share is not modified, but a "ghost" share that keeps track of the changes made by that specific user is used instead. By default, the method "getShareById" in the share provider returns the share from the point of view of the sharer, but it can be used too to get the share from the point of view of a sharee by providing the "recipient" parameter (and if the sharee is not found then the share is returned from the point of view of the sharer). The "ShareAPIController" always formats the share from the point of view of the current user, but when getting the information of a specific share the "recipient" parameter was not given, so it was always returned from the point of view of the sharer, even if the current user was a sharee. Now the "recipient" parameter is set to the current user, and thus the information of the share is returned from the point of view of the current user, be it the sharer or a sharee. Note that this special behaviour of "getShareById" happens only with group shares; with other types of shares the share is the same for the sharer and the sharee, and thus the parameter is ignored; it was added for them too just for consistency. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 89a21d7d1e4..2c638fe4ed6 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -229,7 +229,7 @@ class ShareAPIControllerTest extends TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with('ocinternal:42')
+ ->with('ocinternal:42', 'currentUser')
->will($this->throwException(new \OC\Share20\Exception\ShareNotFound()));
$expected = new \OC\OCS\Result(null, 404, 'wrong share ID, share doesn\'t exist.');
@@ -457,7 +457,7 @@ class ShareAPIControllerTest extends TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with($share->getFullId())
+ ->with($share->getFullId(), 'currentUser')
->willReturn($share);
$userFolder = $this->getMockBuilder('OCP\Files\Folder')->getMock();
@@ -517,7 +517,7 @@ class ShareAPIControllerTest extends TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with('ocinternal:42')
+ ->with('ocinternal:42', 'currentUser')
->willReturn($share);
$this->ocs->getShare(42);