Merge pull request #8880 from owncloud/webdav-read-permissions

Use the permissions exposed by ownCloud for webdav external storages
This commit is contained in:
Thomas Müller 2014-06-05 11:38:02 +02:00
commit d0eb8f8668
1 changed files with 24 additions and 0 deletions

View File

@ -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);
}
}
}