public function moveFileAction(ParamFetcher $paramFetcher)
{
$path = trim($paramFetcher->get('path'));
$target = trim($paramFetcher->get('target'));
$overwrite = filter_var($paramFetcher->get('overwrite'), FILTER_VALIDATE_BOOLEAN);
if (!$overwrite && $this->webFilesystem->has($target)) {
return ['targetExists' => true];
}
//are we allowed to update the old file?
$aclRequest = ACLRequest::create('jarves/file', ['path' => $path])->onlyAddMode();
$this->checkOrThrow($aclRequest);
//are we allowed to create this type of file?
$newFile = $this->webFilesystem->getFile($path)->toArray();
$newFile['path'] = $target;
$aclRequest = ACLRequest::create('jarves/file', $newFile)->setPrimaryObjectItem($newFile)->onlyAddMode();
$this->checkOrThrow($aclRequest);
$this->newFeed($path, 'moved', sprintf('from %s to %s', $path, $target));
$result = $this->webFilesystem->move($path, $target);
return $result;
}