return \OC::$server->getShareManager()->newShare();
}
-
+
public function testDeleteShareShareNotFound() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Wrong share ID, share doesn\'t exist');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testDeleteShareLocked() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Could not delete share');
'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',
$this->assertEquals($result, $ocs->getShare($share->getId())->getData()[0]);
}
-
+
public function testGetShareInvalidNode() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Wrong share ID, share doesn\'t exist');
$this->assertEquals($expected, $this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
}
-
+
public function testCreateShareNoPath() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Please specify a file or folder path');
$this->ocs->createShare();
}
-
+
public function testCreateShareInvalidPath() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Wrong path, file/folder doesn\'t exist');
$this->ocs->createShare('invalid-path');
}
-
+
public function testCreateShareInvalidPermissions() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('invalid permissions');
$this->ocs->createShare('valid-path', 32);
}
-
+
public function testCreateShareUserNoShareWith() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Please specify a valid user');
$this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER);
}
-
+
public function testCreateShareUserNoValidShareWith() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Please specify a valid user');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testCreateShareGroupNoValidShareWith() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Please specify a valid group');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testCreateShareGroupNotAllowed() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Group sharing is disabled by the administrator');
$this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, 'invalidGroup');
}
-
+
public function testCreateShareLinkNoLinksAllowed() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Public link sharing is disabled by the administrator');
$this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK);
}
-
+
public function testCreateShareLinkNoPublicUpload() {
$this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
$this->expectExceptionMessage('Public upload disabled by the administrator');
$this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'true');
}
-
+
public function testCreateShareLinkPublicUploadFile() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Public upload is only possible for publicly shared folders');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled() {
$this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
$this->expectExceptionMessage('Sharing valid-path sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testCreateShareInvalidExpireDate() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Invalid date, date format must be YYYY-MM-DD');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testCreateShareRoomHelperNotAvailable() {
$this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
$this->expectExceptionMessage('Sharing valid-path failed because the back end does not support room shares');
$ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_ROOM, 'recipientRoom');
}
-
+
public function testCreateShareRoomHelperThrowException() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Exception thrown by the helper');
$ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, 'validUser');
}
-
+
public function testUpdateShareCantAccess() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Wrong share ID, share doesn\'t exist');
$this->ocs->updateShare(42);
}
-
+
public function testUpdateNoParametersLink() {
$this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
$this->expectExceptionMessage('Wrong or no update parameter given');
$this->ocs->updateShare(42);
}
-
+
public function testUpdateNoParametersOther() {
$this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
$this->expectExceptionMessage('Wrong or no update parameter given');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testUpdateLinkShareInvalidDate() {
$this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
$this->expectExceptionMessage('Invalid date. Format must be YYYY-MM-DD');
$ocs->updateShare(42, $permissions, $password, null, $publicUpload, $expireDate);
}
-
+
public function testUpdateLinkSharePublicUploadOnFile() {
$this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
$this->expectExceptionMessage('Public upload is only possible for publicly shared folders');
$this->assertEquals($expected->getData(), $result->getData());
}
-
+
public function testUpdateLinkShareSendPasswordByTalkWithTalkDisabledDoesNotChangeOther() {
$this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
$this->expectExceptionMessage('Sharing sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled');
'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',
'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',
| 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"
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"
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