From e906796f99eaaea26cfbb3055ccc27024470b410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 13 Apr 2016 17:31:47 +0200 Subject: [PATCH] ask for share-permissions on propfind --- apps/files_sharing/lib/external/storage.php | 16 ++++++++++++++++ lib/private/files/storage/dav.php | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php index 8fe7af6604..4382dcab0c 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 df0f4c7e91..a555537225 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', )