diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-27 13:10:32 +0200 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2024-08-28 17:22:20 +0200 |
commit | 030c209d22ea93b2f168bd02521d83c525ea26ab (patch) | |
tree | 5f5369c71abcd9746dccc49b186d5427f016b62a /apps/dav/lib | |
parent | 0d41c4991859533b4df89e41368c21437b7464f5 (diff) | |
download | nextcloud-server-030c209d22ea93b2f168bd02521d83c525ea26ab.tar.gz nextcloud-server-030c209d22ea93b2f168bd02521d83c525ea26ab.zip |
fix: Renaming does not need update but delete permissions
Renaming is basically copy + delete (a move), so no need to update permissions.
Especially if the node is in a invalid directory the node should be moveable but not editable.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Node.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 973d5ca6f0e..1d3773220f8 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -117,8 +117,9 @@ abstract class Node implements \Sabre\DAV\INode { * @throws \Sabre\DAV\Exception\Forbidden */ public function setName($name) { - // rename is only allowed if the update privilege is granted - if (!($this->info->isUpdateable() || ($this->info->getMountPoint() instanceof MoveableMount && $this->info->getInternalPath() === ''))) { + // rename is only allowed if the delete privilege is granted + // (basically rename is a copy with delete of the original node) + if (!($this->info->isDeletable() || ($this->info->getMountPoint() instanceof MoveableMount && $this->info->getInternalPath() === ''))) { throw new \Sabre\DAV\Exception\Forbidden(); } @@ -129,7 +130,6 @@ abstract class Node implements \Sabre\DAV\INode { // verify path of the target $this->verifyPath($newPath); - if (!$this->fileView->rename($this->path, $newPath)) { throw new \Sabre\DAV\Exception('Failed to rename '. $this->path . ' to ' . $newPath); } |