From 9eb177e8bc47de840af01c3b1134c1aa1e57adac Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 4 Jun 2014 18:19:52 +0200 Subject: Use the permissions exposed by ownCloud for webdav external storages --- apps/files_external/lib/webdav.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'apps') diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index dc98dcfb808..50be934cc99 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -396,5 +396,29 @@ class DAV extends \OC\Files\Storage\Common { return array('curl'); } } + + public function getPermissions($path) { + $this->init(); + $response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions')); + if (isset($response['{http://owncloud.org/ns}permissions'])) { + $permissions = 0; + $permissionsString = $response['{http://owncloud.org/ns}permissions']; + if (strpos($permissionsString, 'R') !== false) { + $permissions |= \OCP\PERMISSION_SHARE; + } + if (strpos($permissionsString, 'D') !== false) { + $permissions |= \OCP\PERMISSION_DELETE; + } + if (strpos($permissionsString, 'W') !== false) { + $permissions |= \OCP\PERMISSION_UPDATE; + } + if (strpos($permissionsString, 'C') !== false) { + $permissions |= \OCP\PERMISSION_CREATE; + } + return $permissions; + } else { + return parent::getPermissions($path); + } + } } -- cgit v1.2.3