summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/lib/external/storage.php16
-rw-r--r--lib/private/files/storage/dav.php3
2 files changed, 18 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index 8fe7af66044..4382dcab0c3 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -319,5 +319,21 @@ class Storage extends DAV implements ISharedStorage {
}
return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
}
+
+ public function getPermissions($path) {
+ $response = $this->propfind($path);
+ if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) {
+ $permissions = $response['{http://open-collaboration-services.org/ns}share-permissions'];
+ } else {
+ // use default permission if remote server doesn't provide the share permissions
+ if ($this->is_dir($path)) {
+ $permissions = \OCP\Constants::PERMISSION_ALL;
+ } else {
+ $permissions = \OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_CREATE;
+ }
+ }
+
+ return $permissions;
+ }
}
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index df0f4c7e91d..a5555372250 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -246,7 +246,7 @@ class DAV extends Common {
*
* @throws NotFound
*/
- private function propfind($path) {
+ protected function propfind($path) {
$path = $this->cleanPath($path);
$cachedResponse = $this->statCache->get($path);
if ($cachedResponse === false) {
@@ -264,6 +264,7 @@ class DAV extends Common {
'{DAV:}getcontentlength',
'{DAV:}getcontenttype',
'{http://owncloud.org/ns}permissions',
+ '{http://open-collaboration-services.org/ns}share-permissions',
'{DAV:}resourcetype',
'{DAV:}getetag',
)