Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r57304bcaf26cbc87e4007de4bad27e4d13599d00 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 57304bcaf26cbc87e4007de4bad27e4d13599d00) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -792,7 +792,6 @@ label.view =View index.outcome.manage =Outcomes index.outcome.manage.tooltip =Manage learning outcomes and scales -outcome.manage.title =Course outcomes outcome.manage.remove =Remove outcome outcome.manage.remove.confirm =Are you sure you want to remove this outcome? outcome.manage.add =Add outcome @@ -801,12 +800,8 @@ outcome.manage.add.name =Name outcome.manage.add.code =Code outcome.manage.add.description =Description -outcome.manage.add.global =Global outcome.manage.add.scale =Scale outcome.manage.add.save =Save -outcome.manage.scope =Scope -outcome.manage.scope.global =global -outcome.manage.scope.course =course outcome.manage.add.error =Error while saving an outcome outcome.manage.add.error.name.blank =Name can not be blank outcome.manage.add.error.code.blank =Code can not be blank @@ -816,7 +811,6 @@ scale.manage.add =Add scale scale.manage.edit =Edit scale scale.manage.view =View scale -scale.manage.title =Course scales scale.manage.remove =Remove scale scale.manage.remove.scale =Error while removing a scale. It is probably used in some outcomes. scale.manage.remove.confirm =Are you sure you want to remove this scale? Index: lams_central/conf/language/lams/ApplicationResources_el_GR.properties =================================================================== diff -u -r57304bcaf26cbc87e4007de4bad27e4d13599d00 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/conf/language/lams/ApplicationResources_el_GR.properties (.../ApplicationResources_el_GR.properties) (revision 57304bcaf26cbc87e4007de4bad27e4d13599d00) +++ lams_central/conf/language/lams/ApplicationResources_el_GR.properties (.../ApplicationResources_el_GR.properties) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -790,7 +790,7 @@ label.view =\u03a0\u03c1\u03bf\u03b2\u03bf\u03bb\u03ae index.outcome.manage =\u0391\u03c0\u03bf\u03c4\u03b5\u03bb\u03ad\u03c3\u03bc\u03b1\u03c4\u03b1 index.outcome.manage.tooltip =\u0394\u03b9\u03b1\u03c7\u03b5\u03af\u03c1\u03b9\u03c3\u03b7 \u03bc\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03ce\u03bd \u03b1\u03c0\u03bf\u03c4\u03b5\u03bb\u03b5\u03c3\u03bc\u03ac\u03c4\u03c9\u03bd \u03ba\u03b1\u03b9 \u03ba\u03bb\u03b9\u03bc\u03ac\u03ba\u03c9\u03bd -outcome.manage.title =\u039c\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03ac \u0391\u03c0\u03bf\u03c4\u03b5\u03bb\u03ad\u03c3\u03bc\u03b1\u03c4\u03b1 \u03c3\u03b5\u03b9\u03c1\u03ac\u03c2 \u03bc\u03b1\u03b8\u03b7\u03bc\u03ac\u03c4\u03c9\u03bd + outcome.manage.remove =\u0391\u03c6\u03b1\u03af\u03c1\u03b5\u03c3\u03b7 \u03bc\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03bf\u03cd \u03b1\u03c0\u03bf\u03c4\u03b5\u03bb\u03ad\u03c3\u03bc\u03b1\u03c4\u03bf\u03c2 outcome.manage.remove.confirm =\u0395\u03af\u03c3\u03c4\u03b5 \u03b2\u03ad\u03b2\u03b1\u03b9\u03bf\u03b9 \u03cc\u03c4\u03b9 \u03b8\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae\u03c3\u03b5\u03c4\u03b5 \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03bc\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03cc \u03b1\u03c0\u03bf\u03c4\u03ad\u03bb\u03b5\u03c3\u03bc\u03b1; outcome.manage.add =\u03a0\u03c1\u03bf\u03c3\u03b8\u03ae\u03ba\u03b7 \u03bc\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03bf\u03cd \u03b1\u03c0\u03bf\u03c4\u03b5\u03bb\u03ad\u03c3\u03bc\u03b1\u03c4\u03bf\u03c2 @@ -799,12 +799,12 @@ outcome.manage.add.name =\u038c\u03bd\u03bf\u03bc\u03b1 outcome.manage.add.code =\u039a\u03c9\u03b4\u03b9\u03ba\u03cc\u03c2 outcome.manage.add.description =\u03a0\u03b5\u03c1\u03b9\u03b3\u03c1\u03b1\u03c6\u03ae -outcome.manage.add.global =\u03a0\u03b1\u03b3\u03ba\u03cc\u03c3\u03bc\u03b9\u03bf + outcome.manage.add.scale =\u039a\u03bb\u03af\u03bc\u03b1\u03ba\u03b1 outcome.manage.add.save =\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 -outcome.manage.scope =\u03a0\u03b5\u03b4\u03af\u03bf \u03b5\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2 -outcome.manage.scope.global =\u03c0\u03b1\u03b3\u03ba\u03cc\u03c3\u03bc\u03b9\u03bf -outcome.manage.scope.course =\u03c3\u03b5\u03b9\u03c1\u03ac \u03bc\u03b1\u03b8\u03b7\u03bc\u03ac\u03c4\u03c9\u03bd + + + outcome.manage.add.error =\u03a3\u03c6\u03ac\u03bb\u03bc\u03b1 \u03ba\u03b1\u03c4\u03ac \u03c4\u03b7\u03bd \u03b1\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03b5\u03bd\u03cc\u03c2 \u03bc\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03bf\u03cd \u03b1\u03c0\u03bf\u03c4\u03b5\u03bb\u03ad\u03c3\u03bc\u03b1\u03c4\u03bf\u03c2 outcome.manage.add.error.name.blank =\u03a4\u03bf \u03cc\u03bd\u03bf\u03bc\u03b1 \u03b4\u03b5\u03bd \u03bc\u03c0\u03bf\u03c1\u03b5\u03af \u03bd\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03ba\u03b5\u03bd\u03cc outcome.manage.add.error.code.blank =\u039f \u03ba\u03c9\u03b4\u03b9\u03ba\u03cc\u03c2 \u03b4\u03b5\u03bd \u03bc\u03c0\u03bf\u03c1\u03b5\u03af \u03bd\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03ba\u03b5\u03bd\u03cc\u03c2 @@ -814,7 +814,7 @@ scale.manage.add =\u03a0\u03c1\u03bf\u03c3\u03b8\u03ae\u03ba\u03b7 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2 scale.manage.edit =\u0395\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03c3\u03af\u03b1 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2 scale.manage.view =\u03a0\u03c1\u03bf\u03b2\u03bf\u03bb\u03ae \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2 -scale.manage.title =\u039a\u03bb\u03af\u03bc\u03b1\u03ba\u03b5\u03c2 \u03c3\u03b5\u03b9\u03c1\u03ac\u03c2 \u03bc\u03b1\u03b8\u03b7\u03bc\u03ac\u03c4\u03c9\u03bd + scale.manage.remove =\u0391\u03c6\u03b1\u03af\u03c1\u03b5\u03c3\u03b7 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2 scale.manage.remove.scale =\u03a3\u03c6\u03ac\u03bb\u03bc\u03b1 \u03ba\u03b1\u03c4\u03ac \u03c4\u03b7\u03bd \u03b4\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03bc\u03b9\u03b1\u03c2 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2. \u03a7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03b5\u03af\u03c4\u03b1\u03b9 \u03c0\u03b9\u03b8\u03b1\u03bd\u03ce\u03c2 \u03b3\u03b9\u03b1 \u03bf\u03c1\u03b9\u03c3\u03bc\u03ad\u03bd\u03b1 \u03bc\u03b1\u03b8\u03b7\u03c3\u03b9\u03b1\u03ba\u03ac \u03b1\u03c0\u03bf\u03c4\u03b5\u03bb\u03ad\u03c3\u03bc\u03b1\u03c4\u03b1. scale.manage.remove.confirm =\u0395\u03af\u03c3\u03c4\u03b5 \u03b2\u03ad\u03b2\u03b1\u03b9\u03bf\u03b9 \u03cc\u03c4\u03b9 \u03b8\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae\u03c3\u03b5\u03c4\u03b5 \u03b1\u03c5\u03c4\u03ae\u03bd \u03c4\u03b7\u03bd \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1; Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r57304bcaf26cbc87e4007de4bad27e4d13599d00 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 57304bcaf26cbc87e4007de4bad27e4d13599d00) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -790,7 +790,7 @@ label.view =View index.outcome.manage =Outcomes index.outcome.manage.tooltip =Manage learning outcomes and scales -outcome.manage.title =Course outcomes + outcome.manage.remove =Remove outcome outcome.manage.remove.confirm =Are you sure you want to remove this outcome? outcome.manage.add =Add outcome @@ -799,12 +799,12 @@ outcome.manage.add.name =Name outcome.manage.add.code =Code outcome.manage.add.description =Description -outcome.manage.add.global =Global + outcome.manage.add.scale =Scale outcome.manage.add.save =Save -outcome.manage.scope =Scope -outcome.manage.scope.global =global -outcome.manage.scope.course =course + + + outcome.manage.add.error =Error while saving an outcome outcome.manage.add.error.name.blank =Name can not be blank outcome.manage.add.error.code.blank =Code can not be blank @@ -814,7 +814,7 @@ scale.manage.add =Add scale scale.manage.edit =Edit scale scale.manage.view =View scale -scale.manage.title =Course scales + scale.manage.remove =Remove scale scale.manage.remove.scale =Error while removing a scale. It is probably used in some outcomes. scale.manage.remove.confirm =Are you sure you want to remove this scale? Index: lams_central/conf/language/lams/ApplicationResources_es_ES.properties =================================================================== diff -u -r57304bcaf26cbc87e4007de4bad27e4d13599d00 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/conf/language/lams/ApplicationResources_es_ES.properties (.../ApplicationResources_es_ES.properties) (revision 57304bcaf26cbc87e4007de4bad27e4d13599d00) +++ lams_central/conf/language/lams/ApplicationResources_es_ES.properties (.../ApplicationResources_es_ES.properties) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -790,7 +790,7 @@ label.view =Detalle index.outcome.manage =Objetivos de aprendizaje index.outcome.manage.tooltip =Administraci\u00f3n de objetivos de aprendizajey escalas -outcome.manage.title =Objetivos de aprendizaje del curso + outcome.manage.remove =Eliminar objectivo outcome.manage.remove.confirm =\u00bfEst\u00e1s seguro de que quieres eliminar este objetivos de aprendizaje? outcome.manage.add =A\u00f1adir objetivo @@ -799,12 +799,12 @@ outcome.manage.add.name =T\u00edtulo outcome.manage.add.code =C\u00f3digo outcome.manage.add.description =Descripci\u00f3n -outcome.manage.add.global =Global + outcome.manage.add.scale =Escala outcome.manage.add.save =Guardar -outcome.manage.scope =Alcance -outcome.manage.scope.global =Global -outcome.manage.scope.course =Curso + + + outcome.manage.add.error =Error guardando objetivo outcome.manage.add.error.name.blank =T\u00edtulo no puede dejarse en blanco outcome.manage.add.error.code.blank =C\u00f3digo no puede dejarse en blanco @@ -814,7 +814,7 @@ scale.manage.add =Anadir escala scale.manage.edit =Editar escala scale.manage.view =Ver -scale.manage.title =Escalas del curso + scale.manage.remove =Eliminar escala scale.manage.remove.scale =Error al intentar eliminar la escala. Es probable que est\u00e9 siendo usado por alg\u00fan objetivo. scale.manage.remove.confirm =\u00bfEst\u00e1s seguro de que quiere eliminar esta escala? Index: lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java =================================================================== diff -u -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java (.../OutcomeController.java) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) +++ lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java (.../OutcomeController.java) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -23,7 +23,6 @@ package org.lamsfoundation.lams.web.outcome; import java.util.Date; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -45,7 +44,6 @@ import org.lamsfoundation.lams.outcome.OutcomeScaleItem; import org.lamsfoundation.lams.outcome.service.IOutcomeService; import org.lamsfoundation.lams.security.ISecurityService; -import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.Role; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -89,55 +87,18 @@ @RequestMapping("/outcomeManage") public String outcomeManage(HttpServletRequest request, HttpServletResponse response) throws Exception { - Integer userId = getUserDTO().getUserID(); - Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); - - if (organisationId == null) { - // check if user is allowed to view and edit global outcomes - if (!securityService.isSysadmin(userId, "manage global outcomes", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a sysadmin"); - return null; - } - } else { - // check if user is allowed to view and edit course outcomes - if (!securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "manage course outcomes", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - } - List outcomes = outcomeService.getOutcomes(organisationId); + List outcomes = outcomeService.getOutcomes(); request.setAttribute("outcomes", outcomes); - - request.setAttribute("canManageGlobal", userManagementService.isUserSysAdmin()); return "outcome/outcomeManage"; } @RequestMapping("/outcomeEdit") public String outcomeEdit(@ModelAttribute OutcomeForm outcomeForm, HttpServletRequest request, HttpServletResponse response) throws Exception { - Integer userId = getUserDTO().getUserID(); Long outcomeId = WebUtil.readLongParam(request, "outcomeId", true); - Outcome outcome = null; - Integer organisationId = null; - if (outcomeId == null) { - organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); - } else { - outcome = (Outcome) userManagementService.findById(Outcome.class, outcomeId); - if (outcome.getOrganisation() != null) { - // get organisation ID from the outcome - the safest way - organisationId = outcome.getOrganisation().getOrganisationId(); - } - } + Outcome outcome = outcomeId == null ? null : (Outcome) userManagementService.findById(Outcome.class, outcomeId); - if (organisationId != null && !securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "add/edit course outcome", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - - outcomeForm.setOrganisationId(organisationId); - outcomeForm.setContentFolderId(outcomeService.getContentFolderId(organisationId)); + outcomeForm.setContentFolderId(IOutcomeService.OUTCOME_CONTENT_FOLDER_ID); if (outcome == null) { outcomeForm.setScaleId(IOutcomeService.DEFAULT_SCALE_ID); } else { @@ -148,10 +109,9 @@ outcomeForm.setScaleId(outcome.getScale().getScaleId()); } - List scales = outcomeService.getScales(organisationId); + List scales = outcomeService.getScales(); request.setAttribute("scales", scales); - request.setAttribute("canManageGlobal", userManagementService.isUserSysAdmin()); return "outcome/outcomeEdit"; } @@ -161,42 +121,16 @@ HttpServletResponse response) throws Exception { Integer userId = getUserDTO().getUserID(); Long outcomeId = outcomeForm.getOutcomeId(); - Outcome outcome = null; - Integer organisationId = null; - if (outcomeId == null) { - organisationId = outcomeForm.getOrganisationId(); - } else { - outcome = (Outcome) userManagementService.findById(Outcome.class, outcomeId); - if (outcome.getOrganisation() != null) { - // get organisation ID from the outcome - the safest way - organisationId = outcome.getOrganisation().getOrganisationId(); - } - } + Outcome outcome = outcomeId == null ? null : (Outcome) userManagementService.findById(Outcome.class, outcomeId); - if (organisationId == null) { - if (!securityService.isSysadmin(userId, "persist global outcome", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a sysadmin"); - return null; - } - } else { - if (!securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "persist course outcome", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - } - MultiValueMap errorMap = new LinkedMultiValueMap<>(); validateOutcomeForm(outcomeForm, errorMap); if (!errorMap.isEmpty()) { request.setAttribute("errorMap", errorMap); } else { try { - Organisation organisation = (Organisation) (organisationId == null ? null - : userManagementService.findById(Organisation.class, organisationId)); if (outcome == null) { outcome = new Outcome(); - outcome.setOrganisation(organisation); User user = (User) userManagementService.findById(User.class, userId); outcome.setCreateBy(user); outcome.setCreateDateTime(new Date()); @@ -205,7 +139,6 @@ outcome.setName(outcomeForm.getName()); outcome.setCode(outcomeForm.getCode()); outcome.setDescription(outcomeForm.getDescription()); - outcome.setContentFolderId(outcomeForm.getContentFolderId()); long scaleId = outcomeForm.getScaleId() == null || outcomeForm.getScaleId() == 0 ? IOutcomeService.DEFAULT_SCALE_ID : outcomeForm.getScaleId(); @@ -236,22 +169,6 @@ if (outcome == null) { throw new IllegalArgumentException("Can not find an outcome with ID " + outcomeId); } - Integer organisationId = outcome.getOrganisation() == null ? null - : outcome.getOrganisation().getOrganisationId(); - Integer userId = getUserDTO().getUserID(); - - if (organisationId == null) { - if (!securityService.isSysadmin(userId, "remove global outcome", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a sysadmin"); - return null; - } - } else { - if (!securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "remove course outcome", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - } userManagementService.delete(outcome); if (log.isDebugEnabled()) { log.debug("Deleted outcome " + outcomeId); @@ -263,30 +180,8 @@ @ResponseBody public String outcomeSearch(HttpServletRequest request, HttpServletResponse response) throws Exception { String search = WebUtil.readStrParam(request, "term", true); - String organisationIdString = WebUtil.readStrParam(request, "organisationIds", true); - Set organisationIds = null; - Integer userId = getUserDTO().getUserID(); - if (StringUtils.isNotBlank(organisationIdString)) { - String[] split = organisationIdString.split(","); - organisationIds = new HashSet<>(split.length); - for (String organisationId : split) { - organisationIds.add(Integer.valueOf(organisationId)); - } - } - if (organisationIds == null) { - if (!request.isUserInRole(Role.SYSADMIN) && !request.isUserInRole(Role.AUTHOR)) { - String error = "User " + userId + " is not sysadmin nor an author and can not search outcome"; - log.error(error); - throw new SecurityException(error); - } - } else { - for (Integer organisationId : organisationIds) { - securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, "search outcome", - true); - } - } - List outcomes = outcomeService.getOutcomes(search, organisationIds); + List outcomes = outcomeService.getOutcomes(search); ArrayNode responseJSON = JsonNodeFactory.instance.arrayNode(); for (Outcome outcome : outcomes) { ObjectNode outcomeJSON = JsonNodeFactory.instance.objectNode(); @@ -331,7 +226,6 @@ outcome.setName(name); outcome.setCode(code); - outcome.setContentFolderId(outcomeService.getContentFolderId(null)); OutcomeScale scale = (OutcomeScale) userManagementService.findById(OutcomeScale.class, IOutcomeService.DEFAULT_SCALE_ID); outcome.setScale(scale); @@ -345,20 +239,6 @@ outcome = (Outcome) userManagementService.findById(Outcome.class, outcomeId); } - Integer organisationId = outcome.getOrganisation() == null ? null - : outcome.getOrganisation().getOrganisationId(); - Integer userId = getUserDTO().getUserID(); - - if (organisationId == null) { - if (!request.isUserInRole(Role.SYSADMIN) && !request.isUserInRole(Role.AUTHOR)) { - String error = "User " + userId + " is not sysadmin nor an author and can not map outcome"; - log.error(error); - throw new SecurityException(error); - } - } else { - securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, "map outcome", true); - } - List outcomeMappings = outcomeService.getOutcomeMappings(lessonId, toolContentId, itemId); for (OutcomeMapping existingMapping : outcomeMappings) { if (existingMapping.getOutcome().getOutcomeId().equals(outcome.getOutcomeId())) { @@ -420,20 +300,6 @@ Long mappingId = WebUtil.readLongParam(request, "mappingId"); OutcomeMapping outcomeMapping = (OutcomeMapping) userManagementService.findById(OutcomeMapping.class, mappingId); - Organisation organisation = outcomeMapping.getOutcome().getOrganisation(); - Integer organisationId = organisation == null ? null : organisation.getOrganisationId(); - Integer userId = getUserDTO().getUserID(); - if (organisationId == null) { - if (!request.isUserInRole(Role.SYSADMIN) && !request.isUserInRole(Role.AUTHOR)) { - String error = "User " + userId - + " is not sysadmin nor an author and can not remove an outcome mapping"; - log.error(error); - throw new SecurityException(error); - } - } else { - securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, "remove outcome mapping", - true); - } Outcome outcome = outcomeMapping.getOutcome(); Long outcomeId = outcome.getOutcomeId(); userManagementService.delete(outcomeMapping); @@ -559,27 +425,9 @@ @RequestMapping("/scaleManage") public String scaleManage(HttpServletRequest request, HttpServletResponse response) throws Exception { - Integer userId = getUserDTO().getUserID(); - Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); - - if (organisationId == null) { - // check if user is allowed to view and edit global outcomes - if (!securityService.isSysadmin(userId, "manage global scales", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a sysadmin"); - return null; - } - } else { - // check if user is allowed to view and edit course outcomes - if (!securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "manage course scales", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - } - List scales = outcomeService.getScales(organisationId); + List scales = outcomeService.getScales(); request.setAttribute("scales", scales); - request.setAttribute("canManageGlobal", userManagementService.isUserSysAdmin()); return "outcome/scaleManage"; } @@ -590,21 +438,6 @@ if (scale == null) { throw new IllegalArgumentException("Can not find an outcome scale with ID " + scaleId); } - Integer organisationId = scale.getOrganisation() == null ? null : scale.getOrganisation().getOrganisationId(); - Integer userId = getUserDTO().getUserID(); - - if (organisationId == null) { - if (!securityService.isSysadmin(userId, "remove global scale", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a sysadmin"); - return null; - } - } else { - if (!securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, "remove course scale", - false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - } try { userManagementService.delete(scale); if (log.isDebugEnabled()) { @@ -623,28 +456,11 @@ @RequestMapping("/scaleEdit") public String scaleEdit(@ModelAttribute("scaleForm") OutcomeScaleForm scaleForm, HttpServletRequest request, HttpServletResponse response) throws Exception { - Integer userId = getUserDTO().getUserID(); Long scaleId = WebUtil.readLongParam(request, "scaleId", true); - OutcomeScale scale = null; - Integer organisationId = null; - if (scaleId == null) { - organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); - } else { - scale = (OutcomeScale) userManagementService.findById(OutcomeScale.class, scaleId); - if (scale.getOrganisation() != null) { - // get organisation ID from the outcome - the safest way - organisationId = scale.getOrganisation().getOrganisationId(); - } - } + OutcomeScale scale = scaleId == null ? null + : (OutcomeScale) userManagementService.findById(OutcomeScale.class, scaleId); - if (organisationId != null && !securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "add/edit course outcome", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - - scaleForm.setOrganisationId(organisationId); - scaleForm.setContentFolderId(outcomeService.getContentFolderId(organisationId)); + scaleForm.setContentFolderId(IOutcomeService.OUTCOME_CONTENT_FOLDER_ID); if (scale != null) { scaleForm.setScaleId(scale.getScaleId()); scaleForm.setName(scale.getName()); @@ -653,7 +469,6 @@ scaleForm.setItems(scale.getItemString()); } - request.setAttribute("canManageGlobal", userManagementService.isUserSysAdmin()); request.setAttribute("isDefaultScale", outcomeService.isDefaultScale(scaleForm.getScaleId())); return "outcome/scaleEdit"; } @@ -663,35 +478,13 @@ HttpServletResponse response) throws Exception { Integer userId = getUserDTO().getUserID(); Long scaleId = scaleForm.getScaleId(); - OutcomeScale scale = null; - Integer organisationId = null; - if (scaleId == null) { - organisationId = scaleForm.getOrganisationId(); - } else { - scale = (OutcomeScale) userManagementService.findById(OutcomeScale.class, scaleId); - if (outcomeService.isDefaultScale(scale.getScaleId())) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "The default scale can not be altered"); - return null; - } - if (scale.getOrganisation() != null) { - // get organisation ID from the outcome - the safest way - organisationId = scale.getOrganisation().getOrganisationId(); - } + OutcomeScale scale = scaleId == null ? null + : (OutcomeScale) userManagementService.findById(OutcomeScale.class, scaleId); + if (scale != null && outcomeService.isDefaultScale(scaleId)) { + response.sendError(HttpServletResponse.SC_FORBIDDEN, "The default scale can not be altered"); + return null; } - if (organisationId == null) { - if (!securityService.isSysadmin(userId, "persist global scale", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a sysadmin"); - return null; - } - } else { - if (!securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, - "persist course scale", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not an author in the organisation"); - return null; - } - } - MultiValueMap errorMap = new LinkedMultiValueMap<>(1); validateScaleForm(scaleForm, errorMap); List items = OutcomeScale.parseItems(scaleForm.getItems()); @@ -700,11 +493,8 @@ } if (errorMap.isEmpty()) { try { - Organisation organisation = (Organisation) (organisationId == null ? null - : userManagementService.findById(Organisation.class, organisationId)); if (scale == null) { scale = new OutcomeScale(); - scale.setOrganisation(organisation); User user = (User) userManagementService.findById(User.class, userId); scale.setCreateBy(user); scale.setCreateDateTime(new Date()); @@ -713,7 +503,6 @@ scale.setName(scaleForm.getName()); scale.setCode(scaleForm.getCode()); scale.setDescription(scaleForm.getDescription()); - scale.setContentFolderId(scaleForm.getContentFolderId()); userManagementService.save(scale); // find existing scales and add new ones Index: lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeForm.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeForm.java (.../OutcomeForm.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeForm.java (.../OutcomeForm.java) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -24,7 +24,6 @@ public class OutcomeForm { private Long outcomeId; - private Integer organisationId; private Long scaleId; private String name; private String code; @@ -39,14 +38,6 @@ this.outcomeId = outcomeId != null && outcomeId < 1 ? null : outcomeId; } - public Integer getOrganisationId() { - return organisationId; - } - - public void setOrganisationId(Integer organisationId) { - this.organisationId = organisationId != null && organisationId < 1 ? null : organisationId; - } - public Long getScaleId() { return scaleId; } Index: lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeScaleForm.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeScaleForm.java (.../OutcomeScaleForm.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeScaleForm.java (.../OutcomeScaleForm.java) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -24,7 +24,6 @@ public class OutcomeScaleForm { private Long scaleId; - private Integer organisationId; private String name; private String code; private String description; @@ -39,14 +38,6 @@ this.scaleId = scaleId != null && scaleId < 1 ? null : scaleId; } - public Integer getOrganisationId() { - return organisationId; - } - - public void setOrganisationId(Integer organisationId) { - this.organisationId = organisationId != null && organisationId < 1 ? null : organisationId; - } - public String getName() { return name; } Index: lams_central/web/WEB-INF/web.xml =================================================================== diff -u -rb935721d25817b83c29d3166a7fa9b4b9b7d3785 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/WEB-INF/web.xml (.../web.xml) (revision b935721d25817b83c29d3166a7fa9b4b9b7d3785) +++ lams_central/web/WEB-INF/web.xml (.../web.xml) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -612,6 +612,7 @@ Authoring content /authoring/* + /outcome/* GET POST Index: lams_central/web/includes/javascript/main.js =================================================================== diff -u -r6dcc39917657070688863ede60eac6f094929d6a -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/includes/javascript/main.js (.../main.js) (revision 6dcc39917657070688863ede60eac6f094929d6a) +++ lams_central/web/includes/javascript/main.js (.../main.js) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -565,18 +565,17 @@ }, false); } -function showOutcomeDialog(organisationID) { +function showOutcomeDialog() { showDialog("dialogOutcome", { 'height': Math.max(380, Math.min(700, $(window).height() - 30)), 'width' : Math.max(380, Math.min(850, $(window).width() - 60)), - 'title' : organisationID ? LABELS.OUTCOME_COURSE_MANAGE_TITLE : LABELS.OUTCOME_MANAGE_TITLE, + 'title' : LABELS.OUTCOME_MANAGE_TITLE, 'open' : function() { var dialog = $(this); // load contents after opening the dialog $('iframe', dialog) .attr('src', LAMS_URL - + 'outcome.do?method=outcomeManage&organisationID=' - + organisationID); + + 'outcome.do?method=outcomeManage'); } }); } Index: lams_central/web/includes/javascript/outcome.js =================================================================== diff -u -r8ed3b25f15a9ea80cc6f1c3d92210429404501df -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/includes/javascript/outcome.js (.../outcome.js) (revision 8ed3b25f15a9ea80cc6f1c3d92210429404501df) +++ lams_central/web/includes/javascript/outcome.js (.../outcome.js) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -8,13 +8,13 @@ function removeOutcome(outcomeId) { if (confirm(LABELS.REMOVE_OUTCOME_CONFIRM_LABEL)) { - document.location.href = 'outcomeRemove.do?organisationID=' + organisationId + '&outcomeId=' + outcomeId; + document.location.href = 'outcomeRemove.do?outcomeId=' + outcomeId; } } function removeScale(scaleId) { if (confirm(LABELS.REMOVE_SCALE_CONFIRM_LABEL)) { - document.location.href = 'scaleRemove.do?organisationID=' + organisationId + '&scaleId=' + scaleId; + document.location.href = 'scaleRemove.do?scaleId=' + scaleId; } } @@ -28,8 +28,8 @@ // load contents after opening the dialog $('iframe', dialog) .attr('src', LAMS_URL - + 'outcome/outcomeEdit.do?organisationID=' + organisationId - + (outcomeId ? "&outcomeId=" + outcomeId : "")); + + 'outcome/outcomeEdit.do' + + (outcomeId ? "?outcomeId=" + outcomeId : "")); } }); } @@ -44,8 +44,8 @@ // load contents after opening the dialog $('iframe', dialog) .attr('src', LAMS_URL - + 'outcome/scaleEdit.do?organisationID=' + organisationId - + (scaleId ? "&scaleId=" + scaleId : "")); + + 'outcome/scaleEdit.do' + + (scaleId ? "?scaleId=" + scaleId : "")); } }); } @@ -54,14 +54,13 @@ window.parent.showDialog("dialogOutcomeScale", { 'height': Math.max(380, Math.min(700, $(window.parent).height() - 30)), 'width' : Math.max(380, Math.min(850, $(window.parent).width() - 60)), - 'title' : organisationId ? LABELS.OUTCOME_SCALE_COURSE_MANAGE_TITLE : LABELS.OUTCOME_SCALE_MANAGE_TITLE, + 'title' : LABELS.OUTCOME_SCALE_MANAGE_TITLE, 'open' : function() { var dialog = $(this); // load contents after opening the dialog $('iframe', dialog) .attr('src', LAMS_URL - + 'outcome/scaleManage.do?organisationID=' - + organisationId); + + 'outcome/scaleManage.do'); } }); } Index: lams_central/web/main.jsp =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/main.jsp (.../main.jsp) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_central/web/main.jsp (.../main.jsp) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -95,9 +95,7 @@ KUMALIVE_TITLE : '', - OUTCOME_MANAGE_TITLE : '', - - OUTCOME_COURSE_MANAGE_TITLE : '' + OUTCOME_MANAGE_TITLE : '' }, activeOrgId = null${activeOrgId}; Index: lams_central/web/outcome/outcomeEdit.jsp =================================================================== diff -u -rfd2cfad55c7c517931f69334ce644d509ec28140 -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/outcome/outcomeEdit.jsp (.../outcomeEdit.jsp) (revision fd2cfad55c7c517931f69334ce644d509ec28140) +++ lams_central/web/outcome/outcomeEdit.jsp (.../outcomeEdit.jsp) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -21,16 +21,14 @@ var outcomesFrame = $('#dialogOutcome iframe', window.parent.document); if (outcomesFrame.length == 0) { - window.parent.document.location.href = - 'outcome/outcomeManage.do${empty param.organisationID ? "" : "?organisationID=param.organisationID"}'; + window.parent.document.location.href = 'outcome/outcomeManage.do'; } else { outcomesFrame.attr('src', outcomesFrame.attr('src')); $('#dialogOutcomeEdit', window.parent.document).remove(); } - var organisationId = '${param.organisationID}', - LAMS_URL = '', + var LAMS_URL = '', decoderDiv = $('
'), LABELS = { @@ -40,20 +38,14 @@ REMOVE_OUTCOME_CONFIRM_LABEL : decoderDiv.html('').text(), - OUTCOME_SCALE_MANAGE_TITLE : '', - - OUTCOME_SCALE_COURSE_MANAGE_TITLE : '' + OUTCOME_SCALE_MANAGE_TITLE : '' }; - - - -
@@ -66,28 +58,17 @@
- : - - - - - - - - -
-
: - - -
- -
- - - -
+
- - - + Index: lams_central/web/outcome/outcomeManage.jsp =================================================================== diff -u -r8ed3b25f15a9ea80cc6f1c3d92210429404501df -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/outcome/outcomeManage.jsp (.../outcomeManage.jsp) (revision 8ed3b25f15a9ea80cc6f1c3d92210429404501df) +++ lams_central/web/outcome/outcomeManage.jsp (.../outcomeManage.jsp) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -18,8 +18,7 @@ - + - -
@@ -61,22 +56,13 @@
- : - - - - - - - - -
-
Index: lams_central/web/outcome/scaleManage.jsp =================================================================== diff -u -r8ed3b25f15a9ea80cc6f1c3d92210429404501df -r7ba17e82a4cd08db748536b39aef80a4f1c03027 --- lams_central/web/outcome/scaleManage.jsp (.../scaleManage.jsp) (revision 8ed3b25f15a9ea80cc6f1c3d92210429404501df) +++ lams_central/web/outcome/scaleManage.jsp (.../scaleManage.jsp) (revision 7ba17e82a4cd08db748536b39aef80a4f1c03027) @@ -17,8 +17,7 @@