Index: lams_central/conf/security/Owasp.CsrfGuard.properties =================================================================== diff -u -re6dc4db4137cfd6b07a4aa79711b9d12b39fb78e -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/conf/security/Owasp.CsrfGuard.properties (.../Owasp.CsrfGuard.properties) (revision e6dc4db4137cfd6b07a4aa79711b9d12b39fb78e) +++ lams_central/conf/security/Owasp.CsrfGuard.properties (.../Owasp.CsrfGuard.properties) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -60,6 +60,22 @@ org.owasp.csrfguard.protected.centralPortraitDelete=/lams/saveportrait/deletePortrait.do org.owasp.csrfguard.protected.centralPortraitSave=/lams/saveportrait.do +#QB +org.owasp.csrfguard.protected.centralSaveQuestion=/lams/qb/edit/saveOrUpdateQuestion.do +org.owasp.csrfguard.protected.centralSaveQTI=/lams/imsqti/saveQTI.do +org.owasp.csrfguard.protected.centralExportQuestionAsQTI=/lams/imsqti/exportQuestionAsQTI.do +org.owasp.csrfguard.protected.centralExportCollectionAsQTI=/lams/imsqti/exportCollectionAsQTI.do +org.owasp.csrfguard.protected.centralShareCollection=/lams/qb/collection/shareCollection.do +org.owasp.csrfguard.protected.centralUnshareCollection=/lams/qb/collection/unshareCollection.do +org.owasp.csrfguard.protected.centralRemoveCollection=/lams/qb/collection/removeCollection.do +org.owasp.csrfguard.protected.centralChangeCollectionName=/lams/qb/collection/changeCollectionName.do +org.owasp.csrfguard.protected.centralAddCollection=/lams/qb/collection/addCollection.do +org.owasp.csrfguard.protected.centralAddCollectionQuestion=/lams/qb/collection/addCollectionQuestion.do +org.owasp.csrfguard.protected.centralRemoveCollectionQuestion=/lams/qb/collection/removeCollectionQuestion.do +org.owasp.csrfguard.protected.centralMergeQuestions=/lams/qb/stats/merge.do +org.owasp.csrfguard.protected.centralExportQuestionsXml=/lams/xmlQuestions/exportQuestionsXml.do +org.owasp.csrfguard.protected.centralImportQuestionsXml=/lams/xmlQuestions/importQuestionsXml.do + #Author org.owasp.csrfguard.protected.centralAuthorSaveLearningDesign=/lams/authoring/saveLearningDesign.do org.owasp.csrfguard.protected.centralExportLearningDesign=/lams/authoring/exportToolContent/export.do @@ -103,6 +119,7 @@ org.owasp.csrfguard.protected.assessmentAuthoringSave=/lams/tool/laasse10/authoring/updateContent.do org.owasp.csrfguard.protected.assessmentAuthoringDefineLater=/lams/tool/laasse10/authoring/definelater.do +org.owasp.csrfguard.protected.assessmentAuthoringQBSaveQuestion=/lams/tool/laasse10/authoring/saveOrUpdateReference.do org.owasp.csrfguard.protected.assessmentDiscloseCorrectAnswers=/lams/tool/laasse10/monitoring/discloseCorrectAnswers.do org.owasp.csrfguard.protected.assessmentDiscloseGroupsAnswers=/lams/tool/laasse10/monitoring/discloseGroupsAnswers.do org.owasp.csrfguard.protected.assessmentMonitoringSubmissionDeadline=/lams/tool/laasse10/monitoring/setSubmissionDeadline.do @@ -151,6 +168,7 @@ org.owasp.csrfguard.protected.laqaAuthoringSave=/lams/tool/laqa11/authoring/submitAllContent.do org.owasp.csrfguard.protected.laqaAuthoringDefineLater=/lams/tool/laqa11/authoring/definelater.do +org.owasp.csrfguard.protected.laqaAuthoringSaveQuestion=/lams/tool/laqa11/authoring/saveQuestion.do org.owasp.csrfguard.protected.laqaAuthoringRemoveQ=/lams/tool/laqa11/authoring/removeQuestion.do org.owasp.csrfguard.protected.laqaAuthoringSaveOrUpdateCondition=/lams/tool/laqa11/authoringConditions/saveOrUpdateCondition.do org.owasp.csrfguard.protected.laqaAuthoringRemoveCondition=/lams/tool/laqa11/authoringConditions/removeCondition.do Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/EditQbQuestionController.java =================================================================== diff -u -r9f4d4f19dc70ef350ebab8e6aa89cb05e1c78c04 -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/src/java/org/lamsfoundation/lams/web/qb/EditQbQuestionController.java (.../EditQbQuestionController.java) (revision 9f4d4f19dc70ef350ebab8e6aa89cb05e1c78c04) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/EditQbQuestionController.java (.../EditQbQuestionController.java) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -39,6 +39,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.WebApplicationContext; @@ -164,10 +165,9 @@ * HttpSession temporarily. Only they will be persist when the entire authoring page is being * persisted. */ - @RequestMapping("/saveOrUpdateQuestion") + @RequestMapping(path = "/saveOrUpdateQuestion", method = RequestMethod.POST) public String saveOrUpdateQuestion(@ModelAttribute("assessmentQuestionForm") QbQuestionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - //find according question QbQuestion qbQuestion = null; Long oldQuestionUid = null; Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/ImsQtiController.java =================================================================== diff -u -r15e26ff93a8345fa88a194d9344d97870247b63c -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/src/java/org/lamsfoundation/lams/web/qb/ImsQtiController.java (.../ImsQtiController.java) (revision 15e26ff93a8345fa88a194d9344d97870247b63c) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/ImsQtiController.java (.../ImsQtiController.java) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -27,10 +27,13 @@ import org.lamsfoundation.lams.util.MessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; /** * Exports and imports IMS QTI questions. @@ -55,7 +58,7 @@ /** * Parses questions extracted from IMS QTI file and adds them as new QB questions. */ - @RequestMapping(path = "/saveQTI", produces = "text/plain") + @RequestMapping(path = "/saveQTI", produces = "text/plain", method = RequestMethod.POST) @ResponseBody public String saveQTI(HttpServletRequest request, @RequestParam long collectionUid, @RequestParam(defaultValue = "") String contentFolderID) throws UnsupportedEncodingException { @@ -356,31 +359,31 @@ /** * Exports QB question as IMS QTI package. */ - @RequestMapping("/exportQuestionAsQTI") - public String exportQuestionAsQTI(HttpServletRequest request, HttpServletResponse response, + @RequestMapping(path = "/exportQuestionAsQTI", method = RequestMethod.POST) + @ResponseStatus(HttpStatus.OK) + public void exportQuestionAsQTI(HttpServletRequest request, HttpServletResponse response, @RequestParam long qbQuestionUid) { QbQuestion qbQuestion = qbService.getQuestionByUid(qbQuestionUid); List qbQuestions = new LinkedList<>(); qbQuestions.add(qbQuestion); String fileTitle = qbQuestion.getName(); exportQTI(request, response, qbQuestions, fileTitle); - return null; } /** * Exports all questions from QB Collection as IMS QTI package. */ - @RequestMapping("/exportCollectionAsQTI") - public String exportCollectionAsQTI(HttpServletRequest request, HttpServletResponse response, + @RequestMapping(path = "/exportCollectionAsQTI", method = RequestMethod.POST) + @ResponseStatus(HttpStatus.OK) + public void exportCollectionAsQTI(HttpServletRequest request, HttpServletResponse response, @RequestParam long collectionUid) { List qbQuestions = qbService.getCollectionQuestions(collectionUid); QbCollection collection = qbService.getCollectionByUid(collectionUid); String fileTitle = collection.getName(); exportQTI(request, response, qbQuestions, fileTitle); - return null; } /** Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java =================================================================== diff -u -rfc07ada0cd5f3c0908d18243832dceb01efe2992 -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision fc07ada0cd5f3c0908d18243832dceb01efe2992) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -49,6 +49,7 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.w3c.dom.Document; @@ -190,13 +191,13 @@ return null; } - @RequestMapping("/removeCollectionQuestion") + @RequestMapping(path = "/removeCollectionQuestion", method = RequestMethod.POST) @ResponseBody public void removeCollectionQuestion(@RequestParam long collectionUid, @RequestParam int qbQuestionId) { qbService.removeQuestionFromCollectionByQuestionId(collectionUid, qbQuestionId, true); } - @RequestMapping("/addCollectionQuestion") + @RequestMapping(path = "/addCollectionQuestion", method = RequestMethod.POST) @ResponseBody public void addCollectionQuestion(@RequestParam long targetCollectionUid, @RequestParam boolean copy, @RequestParam int qbQuestionId) { @@ -206,7 +207,7 @@ qbService.addQuestionToCollection(targetCollectionUid, qbQuestionId, copy); } - @RequestMapping("/addCollection") + @RequestMapping(path = "/addCollection", method = RequestMethod.POST) @ResponseBody public void addCollection(@RequestParam String name) { if (!Configuration.getAsBoolean(ConfigurationKeys.QB_COLLECTIONS_CREATE_ALLOW)) { @@ -215,7 +216,7 @@ qbService.addCollection(getUserId(), name); } - @RequestMapping("/changeCollectionName") + @RequestMapping(path = "/changeCollectionName", method = RequestMethod.POST) @ResponseBody public String changeCollectionName(@RequestParam(name = "pk") long collectionUid, @RequestParam(name = "value") String name) { @@ -236,19 +237,19 @@ return "true"; } - @RequestMapping("/removeCollection") + @RequestMapping(path = "/removeCollection", method = RequestMethod.POST) @ResponseBody public void removeCollection(@RequestParam long collectionUid) { qbService.removeCollection(collectionUid); } - @RequestMapping("/shareCollection") + @RequestMapping(path = "/shareCollection", method = RequestMethod.POST) @ResponseBody public void shareCollection(@RequestParam long collectionUid, @RequestParam int organisationId) { qbService.shareCollection(collectionUid, organisationId); } - @RequestMapping("/unshareCollection") + @RequestMapping(path = "/unshareCollection", method = RequestMethod.POST) @ResponseBody public void unshareCollection(@RequestParam long collectionUid, @RequestParam int organisationId) { qbService.unshareCollection(collectionUid, organisationId); Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/QbStatsController.java =================================================================== diff -u -r5040f0c9ea761a4189272de822e5736f21b3bfe1 -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/src/java/org/lamsfoundation/lams/web/qb/QbStatsController.java (.../QbStatsController.java) (revision 5040f0c9ea761a4189272de822e5736f21b3bfe1) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/QbStatsController.java (.../QbStatsController.java) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -48,6 +48,7 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @Controller @@ -103,7 +104,7 @@ return "qb/stats"; } - @RequestMapping("/merge") + @RequestMapping(path = "/merge", method = RequestMethod.POST) public String mergeQuestions(@RequestParam long sourceQbQuestionUid, @RequestParam long targetQbQuestionUid, Model model) throws Exception { if (!Configuration.getAsBoolean(ConfigurationKeys.QB_MERGE_ENABLE)) { Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/XmlQuestionsController.java =================================================================== diff -u -r7dc409ffd76dcebc2d210a3a128cdcbba171ff33 -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/src/java/org/lamsfoundation/lams/web/qb/XmlQuestionsController.java (.../XmlQuestionsController.java) (revision 7dc409ffd76dcebc2d210a3a128cdcbba171ff33) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/XmlQuestionsController.java (.../XmlQuestionsController.java) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; @@ -58,7 +59,7 @@ * Imports questions into question bank from uploaded xml file. */ @SuppressWarnings("unchecked") - @RequestMapping("/importQuestionsXml") + @RequestMapping(path = "/importQuestionsXml", method = RequestMethod.POST) @ResponseBody public void importQuestionsXml(@RequestParam("UPLOAD_FILE") MultipartFile file, HttpServletRequest request, @RequestParam long collectionUid) throws ServletException { @@ -110,7 +111,7 @@ /** * Exports xml format questions from question collection. */ - @RequestMapping("/exportQuestionsXml") + @RequestMapping(path = "/exportQuestionsXml", method = RequestMethod.POST) public void exportQuestionsXml(HttpServletRequest request, HttpServletResponse response, @RequestParam long collectionUid) { List qbQuestions = qbService.getCollectionQuestions(collectionUid); Index: lams_central/web/authoring/template/tbl/tbl.jsp =================================================================== diff -u -r4c2d1f37b92435907ec4ce23cb635a7cd9e4161e -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/web/authoring/template/tbl/tbl.jsp (.../tbl.jsp) (revision 4c2d1f37b92435907ec4ce23cb635a7cd9e4161e) +++ lams_central/web/authoring/template/tbl/tbl.jsp (.../tbl.jsp) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -87,13 +87,13 @@ var form = $($.parseHTML(formHTML)); if ( callerID == 'mcq' ) { - var nextNum = +$('#numQuestions').val()+1, - url=getSubmissionURL()+'/importQTI.do?contentFolderID=${contentFolderID}&templatePage=mcquestionQTI&questionNumber=' + var nextNum = +$('#numQuestions').val()+1, + url = getSubmissionURL()+'/importQTI.do?contentFolderID=${contentFolderID}&templatePage=mcquestionQTI&questionNumber=' +nextNum+'&numQuestionsFieldname=numQuestions'; $.ajaxSetup({ cache: true }); $.ajax({ - type: "POST", url: url, + type: "POST", data: form.serializeArray(), success: function(response, status, xhr) { if ( status == "error" ) { @@ -106,15 +106,15 @@ }); } else { var appexIndex = +(callerID.substring(5)), - numQuestionsFieldname = 'numAssessments'+appexIndex, - containingDivName = 'divass'+appexIndex, - nextNum = +$('#'+numQuestionsFieldname).val()+1, - url=getSubmissionURL()+'/importQTI.do?contentFolderID=${contentFolderID}&templatePage=assessmentQTI&questionNumber=' + numQuestionsFieldname = 'numAssessments'+appexIndex, + containingDivName = 'divass'+appexIndex, + nextNum = +$('#'+numQuestionsFieldname).val()+1, + url = getSubmissionURL()+'/importQTI.do?contentFolderID=${contentFolderID}&templatePage=assessmentQTI&questionNumber=' +nextNum+'&containingDivName='+containingDivName+'&numQuestionsFieldname='+numQuestionsFieldname; $.ajaxSetup({ cache: true }); $.ajax({ - type: "POST", url: url, + type: "POST", data: form.serializeArray(), success: function(response, status, xhr) { if ( status == "error" ) { @@ -128,13 +128,10 @@ } } - - - Index: lams_central/web/qb/authoring/addVsa.jsp =================================================================== diff -u -re8a7110708b15579af2c6b31ac52a6da427fef6d -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/web/qb/authoring/addVsa.jsp (.../addVsa.jsp) (revision e8a7110708b15579af2c6b31ac52a6da427fef6d) +++ lams_central/web/qb/authoring/addVsa.jsp (.../addVsa.jsp) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -100,6 +100,7 @@ + Index: lams_central/web/qb/authoring/addessay.jsp =================================================================== diff -u -r9ebb0762842cde9a358626a248132bc7ca650f3c -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b --- lams_central/web/qb/authoring/addessay.jsp (.../addessay.jsp) (revision 9ebb0762842cde9a358626a248132bc7ca650f3c) +++ lams_central/web/qb/authoring/addessay.jsp (.../addessay.jsp) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b) @@ -124,6 +124,7 @@ +