Skip to content

Commit

Permalink
Merge pull request #12324 from nextcloud/add-password-response-parame…
Browse files Browse the repository at this point in the history
…ter-for-returning-the-password-of-link-shares

Add "password" parameter to the response data of link shares
  • Loading branch information
MorrisJobke authored Nov 7, 2018
2 parents ab35433 + b2cc2d6 commit 7940a79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,13 @@ protected function formatShare(\OCP\Share\IShare $share, Node $recipientNode = n
$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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ public function dataGetShare() {
$expected = [
'id' => 101,
'share_type' => \OCP\Share::SHARE_TYPE_LINK,
'password' => 'password',
'share_with' => 'password',
'share_with_displayname' => 'password',
'send_password_by_talk' => false,
Expand Down Expand Up @@ -2687,6 +2688,7 @@ public function dataFormatShare() {
'file_source' => 3,
'file_parent' => 1,
'file_target' => 'myTarget',
'password' => 'mypassword',
'share_with' => 'mypassword',
'share_with_displayname' => 'mypassword',
'send_password_by_talk' => false,
Expand Down Expand Up @@ -2736,6 +2738,7 @@ public function dataFormatShare() {
'file_source' => 3,
'file_parent' => 1,
'file_target' => 'myTarget',
'password' => 'mypassword',
'share_with' => 'mypassword',
'share_with_displayname' => 'mypassword',
'send_password_by_talk' => true,
Expand Down

0 comments on commit 7940a79

Please sign in to comment.