summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-03-03 20:58:18 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-03-31 20:12:34 +0200
commit8c0ef4c4bda4836aa7f4f3b180d1d132c8ca9879 (patch)
treed42260371b3031a8dcd8ef0e7ac1eba4e6bfe9e2 /build
parentbfb5748f1f9d0c76ce311a88ea117c0cb3d7a653 (diff)
downloadnextcloud-server-8c0ef4c4bda4836aa7f4f3b180d1d132c8ca9879.tar.gz
nextcloud-server-8c0ef4c4bda4836aa7f4f3b180d1d132c8ca9879.zip
Add sharePermissions webdav property
This property can be queries by the clients so they know the max permissions they can use to share a file with. This will improve the UX. The oc:permissions proptery is not enough since mountpoints have different permissions (delete + move by default). By making it a new property the clients can just request it. On older servers it will just return a 404 for that property (and thus they know they have to fall back to their hacky work arounds). But if the property is returned the client can show proper info. * unit tests * intergration test
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/WebDav.php14
-rw-r--r--build/integration/features/sharing-v1.feature104
2 files changed, 118 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index b56a1b7d2f6..2ef5f252f11 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -316,6 +316,20 @@ trait WebDav {
}
/**
+ * @When User :user uploads file with content :content to :destination
+ */
+ public function userUploadsAFileWithContentTo($user, $content, $destination)
+ {
+ $file = \GuzzleHttp\Stream\Stream::factory($content);
+ try {
+ $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
+ } catch (\GuzzleHttp\Exception\ServerException $e) {
+ // 4xx and 5xx responses cause an exception
+ $this->response = $e->getResponse();
+ }
+ }
+
+ /**
* @When User :user deletes file :file
* @param string $user
* @param string $file
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index ba535e83aab..b9d77120b9c 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -566,3 +566,107 @@ Feature: sharing
| path | welcome.txt |
| shareType | 3 |
Then share ids should match
+
+ Scenario: Correct webdav share-permissions for owned file
+ Given user "user0" exists
+ And User "user0" uploads file with content "foo" to "/tmp.txt"
+ When as "user0" gets properties of folder "/tmp.txt" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "19"
+
+ Scenario: Correct webdav share-permissions for received file with edit and reshare permissions
+ Given user "user0" exists
+ And user "user1" exists
+ And User "user0" uploads file with content "foo" to "/tmp.txt"
+ And file "tmp.txt" of user "user0" is shared with user "user1"
+ When as "user1" gets properties of folder "/tmp.txt" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "19"
+
+ Scenario: Correct webdav share-permissions for received file with edit permissions but no reshare permissions
+ Given user "user0" exists
+ And user "user1" exists
+ And User "user0" uploads file with content "foo" to "/tmp.txt"
+ And file "tmp.txt" of user "user0" is shared with user "user1"
+ And As an "user0"
+ And Updating last share with
+ | permissions | 3 |
+ When as "user1" gets properties of folder "/tmp.txt" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "0"
+
+ Scenario: Correct webdav share-permissions for received file with reshare permissions but no edit permissions
+ Given user "user0" exists
+ And user "user1" exists
+ And User "user0" uploads file with content "foo" to "/tmp.txt"
+ And file "tmp.txt" of user "user0" is shared with user "user1"
+ And As an "user0"
+ And Updating last share with
+ | permissions | 17 |
+ When as "user1" gets properties of folder "/tmp.txt" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "17"
+
+ Scenario: Correct webdav share-permissions for owned folder
+ Given user "user0" exists
+ And user "user0" created a folder "/tmp"
+ When as "user0" gets properties of folder "/" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "31"
+
+ Scenario: Correct webdav share-permissions for received folder with all permissions
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user0" created a folder "/tmp"
+ And file "/tmp" of user "user0" is shared with user "user1"
+ When as "user1" gets properties of folder "/tmp" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "31"
+
+ Scenario: Correct webdav share-permissions for received folder with all permissions but edit
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user0" created a folder "/tmp"
+ And file "/tmp" of user "user0" is shared with user "user1"
+ And As an "user0"
+ And Updating last share with
+ | permissions | 29 |
+ When as "user1" gets properties of folder "/tmp" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "29"
+
+ Scenario: Correct webdav share-permissions for received folder with all permissions but create
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user0" created a folder "/tmp"
+ And file "/tmp" of user "user0" is shared with user "user1"
+ And As an "user0"
+ And Updating last share with
+ | permissions | 27 |
+ When as "user1" gets properties of folder "/tmp" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "27"
+
+ Scenario: Correct webdav share-permissions for received folder with all permissions but delete
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user0" created a folder "/tmp"
+ And file "/tmp" of user "user0" is shared with user "user1"
+ And As an "user0"
+ And Updating last share with
+ | permissions | 23 |
+ When as "user1" gets properties of folder "/tmp" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "23"
+
+ Scenario: Correct webdav share-permissions for received folder with all permissions but share
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user0" created a folder "/tmp"
+ And file "/tmp" of user "user0" is shared with user "user1"
+ And As an "user0"
+ And Updating last share with
+ | permissions | 15 |
+ When as "user1" gets properties of folder "/tmp" with
+ |{http://owncloud.org/ns}share-permissions|
+ Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "0"