ask for share-permissions on propfind

This commit is contained in:
Björn Schießle 2016-04-13 17:31:47 +02:00
parent 52669d0ea3
commit e906796f99
No known key found for this signature in database
GPG key ID: 2378A753E2BF04F6
2 changed files with 18 additions and 1 deletions

View file

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

View file

@ -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',
)