Return whether the file is readable or not in the DAV permissions

Until now it was safe to assume that every file was readable by its
owner, so there was no need to return whether the file was readable or
not. However, with the introduction of end to end encryption that is no
longer the case, and it is now necessary to explicitly provide that
information.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2017-11-02 17:28:58 +01:00
parent 8ee765a617
commit 555d582f35
3 changed files with 20 additions and 15 deletions

View File

@ -299,6 +299,9 @@ abstract class Node implements \Sabre\DAV\INode {
if ($this->info->isMounted()) {
$p .= 'M';
}
if ($this->info->isReadable()) {
$p .= 'G';
}
if ($this->info->isDeletable()) {
$p .= 'D';
}

View File

@ -41,15 +41,17 @@ use OCP\Share\IShare;
class NodeTest extends \Test\TestCase {
public function davPermissionsProvider() {
return array(
array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RDNVW'),
array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RDNVCK'),
array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRDNVW'),
array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RD'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RDNV'),
array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RGDNVW'),
array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RGDNVCK'),
array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRGDNVW'),
array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMGDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SGDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RGD'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RGNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RGDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'file', false, false, 'RDNVW'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RGDNV'),
array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'dir', false, false, 'RDNVCK'),
);
}

View File

@ -167,7 +167,7 @@ Feature: sharing
And folder "/merge-test-outside-perms" of user "user0" is shared with user "user1" with permissions 31
Then as "user1" gets properties of folder "/merge-test-outside-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
And as "user1" the folder "/merge-test-outside-perms (2)" does not exist
Scenario: Merging shares for recipient when shared from outside with two groups
@ -197,7 +197,7 @@ Feature: sharing
And folder "/merge-test-outside-twogroups-perms" of user "user0" is shared with group "group2" with permissions 31
Then as "user1" gets properties of folder "/merge-test-outside-twogroups-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
And as "user1" the folder "/merge-test-outside-twogroups-perms (2)" does not exist
Scenario: Merging shares for recipient when shared from outside with two groups and member
@ -214,7 +214,7 @@ Feature: sharing
And folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with user "user1" with permissions 1
Then as "user1" gets properties of folder "/merge-test-outside-twogroups-member-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
And as "user1" the folder "/merge-test-outside-twogroups-member-perms (2)" does not exist
Scenario: Merging shares for recipient when shared from inside with group
@ -253,7 +253,7 @@ Feature: sharing
And folder "/merge-test-inside-twogroups-perms" of user "user0" is shared with group "group2"
Then as "user0" gets properties of folder "/merge-test-inside-twogroups-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "RDNVCK"
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "RGDNVCK"
And as "user0" the folder "/merge-test-inside-twogroups-perms (2)" does not exist
And as "user0" the folder "/merge-test-inside-twogroups-perms (3)" does not exist
@ -270,7 +270,7 @@ Feature: sharing
And folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
Then as "user1" gets properties of folder "/merge-test-outside-groups-renamebeforesecondshare-renamed" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
And as "user1" the folder "/merge-test-outside-groups-renamebeforesecondshare" does not exist
Scenario: Merging shares for recipient when shared from outside with user then group and recipient renames in between
@ -287,7 +287,7 @@ Feature: sharing
And folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
Then as "user1" gets properties of folder "/merge-test-outside-groups-renamebeforesecondshare-renamed" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
And as "user1" the folder "/merge-test-outside-groups-renamebeforesecondshare" does not exist
Scenario: Empting trashbin