diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-06-24 16:45:00 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-06-24 16:45:00 +0200 |
commit | 004280e407beca36bfc64640f9ebeb42e40a4cd7 (patch) | |
tree | 6384d18dcd77b5c2378e79e8b7dc756b9f3433eb | |
parent | 1e7a3a4b3bd54cd8c55e5d88e79d3a20ccb26e80 (diff) | |
parent | 6c3da1ec90638a865a735e520493e3b4ec6eb8d9 (diff) | |
download | nextcloud-server-004280e407beca36bfc64640f9ebeb42e40a4cd7.tar.gz nextcloud-server-004280e407beca36bfc64640f9ebeb42e40a4cd7.zip |
Merge pull request #17136 from rullzer/fix_remove_link_OCS
Allow removing of link password in OCS again
-rw-r--r-- | apps/files_sharing/tests/api.php | 24 | ||||
-rw-r--r-- | lib/private/share/share.php | 2 |
2 files changed, 24 insertions, 2 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 44c6b1dc4b9..d5a6fd5b657 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -888,7 +888,6 @@ class Test_Files_Sharing_Api extends TestCase { $this->assertEquals('1', $newUserShare['permissions']); // update password for link share - $this->assertTrue(empty($linkShare['share_with'])); $params = array(); @@ -913,6 +912,29 @@ class Test_Files_Sharing_Api extends TestCase { $this->assertTrue(is_array($newLinkShare)); $this->assertTrue(!empty($newLinkShare['share_with'])); + // Remove password for link share + $params = array(); + $params['id'] = $linkShare['id']; + $params['_put'] = array(); + $params['_put']['password'] = ''; + + $result = \OCA\Files_Sharing\API\Local::updateShare($params); + + $this->assertTrue($result->succeeded()); + + $items = \OCP\Share::getItemShared('file', $linkShare['file_source']); + + $newLinkShare = null; + foreach ($items as $item) { + if ($item['share_type'] === \OCP\Share::SHARE_TYPE_LINK) { + $newLinkShare = $item; + break; + } + } + + $this->assertTrue(is_array($newLinkShare)); + $this->assertTrue(empty($newLinkShare['share_with'])); + \OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2); diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 027c518f9f1..954071fdd6c 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1220,7 +1220,7 @@ class Share extends Constants { $qb->update('`*PREFIX*share`') ->set('`share_with`', ':pass') ->where('`id` = :shareId') - ->setParameter(':pass', is_null($password) ? 'NULL' : \OC::$server->getHasher()->hash($password)) + ->setParameter(':pass', is_null($password) ? null : \OC::$server->getHasher()->hash($password)) ->setParameter(':shareId', $shareId); $qb->execute(); |