diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-06 23:48:28 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-06 23:48:28 +0100 |
commit | b2cc2d602396b7456a59a44f415669dd8fca0e05 (patch) | |
tree | 7e8059c50092f4245b74b678ac17da78c445cd57 /apps | |
parent | 85d2c7ec384a9e5a8529d7c6410c0e648efd882d (diff) | |
download | nextcloud-server-b2cc2d602396b7456a59a44f415669dd8fca0e05.tar.gz nextcloud-server-b2cc2d602396b7456a59a44f415669dd8fca0e05.zip |
Add "password" parameter to the response data of link shares
Due to legacy reasons the password of link shares was returned in the
"share_with" and "share_with_displayname" parameters of the response
data. Now a proper "password" parameter is returned too; the old
"share_with" and "share_with_displayname" parameters are kept, although
deprecated, and they will be removed in a future version of Nextcloud.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareAPIControllerTest.php | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index f61b9dac58a..e33f93e8ce6 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -208,9 +208,13 @@ class ShareAPIController extends OCSController { $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); } else if ($share->getShareType() === Share::SHARE_TYPE_LINK) { + // "share_with" and "share_with_displayname" for passwords of link + // shares was deprecated in Nextcloud 15, use "password" instead. $result['share_with'] = $share->getPassword(); $result['share_with_displayname'] = $share->getPassword(); + $result['password'] = $share->getPassword(); + $result['send_password_by_talk'] = $share->getSendPasswordByTalk(); $result['token'] = $share->getToken(); diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index efc252d49d7..67130c01eb5 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -428,6 +428,7 @@ class ShareAPIControllerTest extends TestCase { $expected = [ 'id' => 101, 'share_type' => \OCP\Share::SHARE_TYPE_LINK, + 'password' => 'password', 'share_with' => 'password', 'share_with_displayname' => 'password', 'send_password_by_talk' => false, @@ -2687,6 +2688,7 @@ class ShareAPIControllerTest extends TestCase { 'file_source' => 3, 'file_parent' => 1, 'file_target' => 'myTarget', + 'password' => 'mypassword', 'share_with' => 'mypassword', 'share_with_displayname' => 'mypassword', 'send_password_by_talk' => false, @@ -2736,6 +2738,7 @@ class ShareAPIControllerTest extends TestCase { 'file_source' => 3, 'file_parent' => 1, 'file_target' => 'myTarget', + 'password' => 'mypassword', 'share_with' => 'mypassword', 'share_with_displayname' => 'mypassword', 'send_password_by_talk' => true, |