diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-17 12:07:19 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-17 12:07:19 +0300 |
commit | f28f6a3001531732ff1fbb7f73af0d388b028281 (patch) | |
tree | 446dde386a1ead737bd4c9212c600da236115e24 | |
parent | 25027c31ffc3defca00366d23996c6413aa027f0 (diff) | |
parent | 8c035ae6f68cdcb95f788b210602c68197a09de2 (diff) |
Merge pull request #23302 from owncloud/fed-unshare-with-9
[9.0] Specify the target user when unsharing a federated share
-rw-r--r-- | apps/files_sharing/api/server2server.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/server2server.php | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php index 6da95ed6549..a3d58880f70 100644 --- a/apps/files_sharing/api/server2server.php +++ b/apps/files_sharing/api/server2server.php @@ -178,7 +178,7 @@ class Server2Server { if ($share) { // userId must be set to the user who unshares - \OCP\Share::unshare($share['item_type'], $share['item_source'], $share['share_type'], null, $share['uid_owner']); + \OCP\Share::unshare($share['item_type'], $share['item_source'], $share['share_type'], $share['share_with'], $share['uid_owner']); list($file, $link) = $this->getFile($share['uid_owner'], $share['file_source']); diff --git a/apps/files_sharing/tests/server2server.php b/apps/files_sharing/tests/server2server.php index 298f1008f71..7714f274c6d 100644 --- a/apps/files_sharing/tests/server2server.php +++ b/apps/files_sharing/tests/server2server.php @@ -147,6 +147,38 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { $this->assertEmpty($data); } + function testDeclineShareMultiple() { + $dummy = \OCP\DB::prepare(' + INSERT INTO `*PREFIX*share` + (`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + '); + $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token1', 'foo@bar')); + $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token2', 'bar@bar')); + + $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); + $result = $verify->execute(); + $data = $result->fetchAll(); + $this->assertCount(2, $data); + + $_POST['token'] = 'token1'; + $this->s2s->declineShare(array('id' => $data[0]['id'])); + + $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); + $result = $verify->execute(); + $data = $result->fetchAll(); + $this->assertCount(1, $data); + $this->assertEquals('bar@bar', $data[0]['share_with']); + + $_POST['token'] = 'token2'; + $this->s2s->declineShare(array('id' => $data[0]['id'])); + + $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); + $result = $verify->execute(); + $data = $result->fetchAll(); + $this->assertEmpty($data); + } + /** * @dataProvider dataTestDeleteUser */ |