UPDATE permissions qualify for renaming a node

This commit is contained in:
Joas Schilling 2016-09-07 11:22:57 +02:00
parent 14299e44e2
commit 42b9eed5dc
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 10 additions and 5 deletions

View File

@ -204,13 +204,18 @@ class ObjectTree extends \Sabre\DAV\Tree {
}
$infoDestination = $this->fileView->getFileInfo(dirname($destinationPath));
$infoSource = $this->fileView->getFileInfo($sourcePath);
if ($this->fileView->file_exists($destinationPath)) {
$destinationPermission = $infoDestination && $infoDestination->isUpdateable();
if (dirname($destinationPath) === dirname($sourcePath)) {
$sourcePermission = $infoDestination && $infoDestination->isUpdateable();
$destinationPermission = $sourcePermission;
} else {
$destinationPermission = $infoDestination && $infoDestination->isCreatable();
$infoSource = $this->fileView->getFileInfo($sourcePath);
if ($this->fileView->file_exists($destinationPath)) {
$destinationPermission = $infoDestination && $infoDestination->isUpdateable();
} else {
$destinationPermission = $infoDestination && $infoDestination->isCreatable();
}
$sourcePermission = $infoSource && $infoSource->isDeletable();
}
$sourcePermission = $infoSource && $infoSource->isDeletable();
if (!$destinationPermission || !$sourcePermission) {
throw new Forbidden('No permissions to move object.');