/** * @ApiDoc( * section="File Manager", * description="Creates a folder in /web" * ) * * @Rest\RequestParam(name="path", requirements=".+", strict=true, description="The file path") * * @Rest\Put("/admin/file/dir") * * @param ParamFetcher $paramFetcher * * @return bool */ public function createFolderAction(ParamFetcher $paramFetcher) { $path = $paramFetcher->get('path'); $pseudoItem = ['path' => $path, 'type' => FileInfo::DIR]; //are we allowed to create this type of dir? $aclRequest = ACLRequest::create('jarves/file', $pseudoItem)->onlyAddMode()->setPrimaryObjectItem($pseudoItem); $this->checkOrThrow($aclRequest); //are we allowed to update the target folder? $aclRequest = ACLRequest::create('jarves/file', ['path' => dirname($path)])->onlyUpdateMode(); $this->checkOrThrow($aclRequest); if ($result = $this->webFilesystem->mkdir($path)) { $this->newFeed($path, 'created', $path); } return $result; }