Rename must be possible with update-only permission
and this as long as the rename is done within the same folder.
This commit is contained in:
parent
5ba508b346
commit
5f7b3a4dbe
|
@ -293,16 +293,25 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
|
||||||
// we need the paths relative to data/user/files
|
// we need the paths relative to data/user/files
|
||||||
$relPath1 = $this->getMountPoint() . '/' . $path1;
|
$relPath1 = $this->getMountPoint() . '/' . $path1;
|
||||||
$relPath2 = $this->getMountPoint() . '/' . $path2;
|
$relPath2 = $this->getMountPoint() . '/' . $path2;
|
||||||
|
|
||||||
$targetExists = $this->file_exists($path2);
|
|
||||||
|
|
||||||
// check for update permissions on the share
|
|
||||||
if (($targetExists && $this->isUpdatable('')) || (!$targetExists && $this->isCreatable(''))) {
|
|
||||||
|
|
||||||
$pathinfo = pathinfo($relPath1);
|
$pathinfo = pathinfo($relPath1);
|
||||||
|
|
||||||
|
$isPartFile = (isset($pathinfo['extension']) && $pathinfo['extension'] === 'part');
|
||||||
|
$targetExists = $this->file_exists($path2);
|
||||||
|
$sameFolder = (dirname($relPath1) === dirname($relPath2));
|
||||||
|
if ($targetExists || ($sameFolder && !$isPartFile)) {
|
||||||
|
// note that renaming a share mount point is always allowed
|
||||||
|
if (!$this->isUpdatable('')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!$this->isCreatable('')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// for part files we need to ask for the owner and path from the parent directory because
|
// for part files we need to ask for the owner and path from the parent directory because
|
||||||
// the file cache doesn't return any results for part files
|
// the file cache doesn't return any results for part files
|
||||||
if (isset($pathinfo['extension']) && $pathinfo['extension'] === 'part') {
|
if ($isPartFile) {
|
||||||
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
|
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
|
||||||
$path1 = $path1 . '/' . $pathinfo['basename'];
|
$path1 = $path1 . '/' . $pathinfo['basename'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -314,9 +323,6 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
|
||||||
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
|
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function copy($path1, $path2) {
|
public function copy($path1, $path2) {
|
||||||
// Copy the file if CREATE permission is granted
|
// Copy the file if CREATE permission is granted
|
||||||
if ($this->isCreatable(dirname($path2))) {
|
if ($this->isCreatable(dirname($path2))) {
|
||||||
|
|
Loading…
Reference in New Issue