Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
UPDATE permissions qualify for renaming a node
  • Loading branch information
nickvergessen committed Sep 8, 2016
commit 42b9eed5dcde89e1f2323efcdca0cbe859725631
15 changes: 10 additions & 5 deletions apps/dav/lib/Connector/Sabre/ObjectTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,18 @@ public function move($sourcePath, $destinationPath) {
}

$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.');
Expand Down