class DocumentsController {

    @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'EDIT_DOCUMENTS_SECTION')")
    @PostMapping(value = "/config/{documentConfigId}", params = "uploadDocument")
    public String uploadDocument(@PathVariable("projectId") long projectId,
                                 @PathVariable("documentConfigId") long documentConfigId,
                                 @ModelAttribute(FORM_ATTR) DocumentForm form,
                                 @SuppressWarnings("unused") BindingResult bindingResult,
                                 ValidationHandler validationHandler,
                                 Model model,
                                 UserResource loggedInUser) {

        return performActionOrBindErrorsToField(
                projectId, documentConfigId, validationHandler, model, loggedInUser, "document", form, () -> {
                    MultipartFile file = form.getDocument();
                    return documentsRestService.uploadDocument(projectId, documentConfigId, file.getContentType(), file.getSize(),
                            file.getOriginalFilename(), getMultipartFileBytes(file));
                });
    }

    public  DocumentsController();
    @Autowired public  DocumentsController(DocumentsPopulator populator, DocumentsRestService documentsRestService);

}