Merge pull request #18799 from nextcloud/fix/inheritedshares/no_link_shares

Do not show link shares in inherited list
This commit is contained in:
John Molakvoæ 2020-01-15 11:06:34 +01:00 committed by GitHub
commit cc05aa2044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 50 deletions

View File

@ -222,12 +222,12 @@ class ShareAPIController extends OCSController {
$group = $this->groupManager->get($share->getSharedWith());
$result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith();
} else if ($share->getShareType() === Share::SHARE_TYPE_LINK) {
} else if ($share->getShareType() === IShare::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['share_with_displayname'] = '(' . $this->l->t('Shared link') . ')';
$result['password'] = $share->getPassword();

View File

@ -664,7 +664,7 @@ class ShareAPIControllerTest extends TestCase {
'share_type' => \OCP\Share::SHARE_TYPE_LINK,
'password' => 'password',
'share_with' => 'password',
'share_with_displayname' => 'password',
'share_with_displayname' => '(Shared link)',
'send_password_by_talk' => false,
'uid_owner' => 'initiatorId',
'displayname_owner' => 'initiatorDisplay',
@ -3709,7 +3709,7 @@ class ShareAPIControllerTest extends TestCase {
'file_target' => 'myTarget',
'password' => 'mypassword',
'share_with' => 'mypassword',
'share_with_displayname' => 'mypassword',
'share_with_displayname' => '(Shared link)',
'send_password_by_talk' => false,
'mail_send' => 0,
'url' => 'myLink',
@ -3761,7 +3761,7 @@ class ShareAPIControllerTest extends TestCase {
'file_target' => 'myTarget',
'password' => 'mypassword',
'share_with' => 'mypassword',
'share_with_displayname' => 'mypassword',
'share_with_displayname' => '(Shared link)',
'send_password_by_talk' => true,
'mail_send' => 0,
'url' => 'myLink',

View File

@ -343,26 +343,8 @@ Feature: sharing
| permissions | 16 |
And As an "user1"
And accepting last share
# And folder "first" of user "user0" is shared with user "user1"
# And creating a share with
# | path | /first/second |
# | shareType | 0 |
# | shareWith | user2 |
# | permissions | 16 |
And folder "first/second" of user "user0" is shared with user "user2"
# And As an "user1"
# And creating a share with
# | path | /first/test1.txt |
# | shareType | 0 |
# | shareWith | user3 |
# | permissions | 8 |
And file "first/test1.txt" of user "user0" is shared with user "user3"
# And As an "user2"
# And creating a share with
# | path | /second/test2.txt |
# | shareType | 0 |
# | shareWith | user3 |
# | permissions | 8 |
And file "first/second/test2.txt" of user "user0" is shared with user "user3"
# get inherited shares from the owner PoV
And As an "user0"
@ -372,14 +354,14 @@ Feature: sharing
And User "user0" should not be included in the response
And User "user1" should be included in the response
And User "user2" should be included in the response
And User "user3" should be included in the response
And User "user3" should not be included in the response
When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And User "user0" should not be included in the response
And User "user1" should be included in the response
And User "user2" should not be included in the response
And User "user3" should be included in the response
And User "user3" should not be included in the response
# get inherited shares from the a user with no shares rights
And As an "user2"
When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
@ -393,13 +375,13 @@ Feature: sharing
And User "user0" should not be included in the response
And User "user1" should not be included in the response
And User "user2" should be included in the response
And User "user3" should be included in the response
And User "user3" should not be included in the response
When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And User "user0" should not be included in the response
And User "user1" should not be included in the response
And User "user2" should not be included in the response
And User "user3" should be included in the response
And User "user3" should not be included in the response
# See sharing-v1-part2.feature