Fix permissions functions for webdav external storages
This commit is contained in:
parent
4bc8a2550d
commit
be93b0d01d
|
@ -400,6 +400,22 @@ class DAV extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isUpdatable($path) {
|
||||||
|
return (bool)($this->getPermissions($path) & \OCP\PERMISSION_UPDATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isCreatable($path) {
|
||||||
|
return (bool)($this->getPermissions($path) & \OCP\PERMISSION_CREATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isSharable($path) {
|
||||||
|
return (bool)($this->getPermissions($path) & \OCP\PERMISSION_SHARE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDeletable($path) {
|
||||||
|
return (bool)($this->getPermissions($path) & \OCP\PERMISSION_DELETE);
|
||||||
|
}
|
||||||
|
|
||||||
public function getPermissions($path) {
|
public function getPermissions($path) {
|
||||||
$this->init();
|
$this->init();
|
||||||
$response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions'));
|
$response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions'));
|
||||||
|
@ -419,8 +435,12 @@ class DAV extends \OC\Files\Storage\Common {
|
||||||
$permissions |= \OCP\PERMISSION_CREATE;
|
$permissions |= \OCP\PERMISSION_CREATE;
|
||||||
}
|
}
|
||||||
return $permissions;
|
return $permissions;
|
||||||
|
} else if ($this->is_dir($path)) {
|
||||||
|
return \OCP\PERMISSION_ALL;
|
||||||
|
} else if ($this->file_exists($path)) {
|
||||||
|
return \OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE;
|
||||||
} else {
|
} else {
|
||||||
return parent::getPermissions($path);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue