Index: lams_admin/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r63bee30ea13fab1267c0744f26929af1736a1cf9 -re325f88e2e856294ed9cde0f90303f84e2ceea8d --- lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 63bee30ea13fab1267c0744f26929af1736a1cf9) +++ lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -635,5 +635,7 @@ sysadmin.maintain.session.name =Name sysadmin.alternative.user.id.name =Use alternative parameter name "lis_person_sourcedid" to get user id +config.header.privacy.settings =Privacy settings +config.restricted.displaying.user.names.in.groupings =Groupings: only display names for learners within own group #======= End labels: Exported 627 labels for en AU ===== Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20191010.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20191010.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20191010.sql (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -0,0 +1,10 @@ +SET AUTOCOMMIT = 0; +set FOREIGN_KEY_CHECKS = 0; + +-- LDEV-4874 Restrict displaying names for students that are not within student's group +insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) +values ('RestrictedGroupUserNames','true', 'config.restricted.displaying.user.names.in.groupings', 'config.header.privacy.settings', 'BOOLEAN', 0); + +COMMIT; +SET AUTOCOMMIT = 1; +set FOREIGN_KEY_CHECKS = 1; Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/GroupDTO.java =================================================================== diff -u -r14ed4a70dd8a2a61be0e780c0adfba9737b99477 -re325f88e2e856294ed9cde0f90303f84e2ceea8d --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/GroupDTO.java (.../GroupDTO.java) (revision 14ed4a70dd8a2a61be0e780c0adfba9737b99477) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/GroupDTO.java (.../GroupDTO.java) (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -30,6 +30,7 @@ import org.lamsfoundation.lams.learningdesign.Group; import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserBasicDTO; import org.lamsfoundation.lams.util.AlphanumComparator; /** Grouping object, suitable for sending to Authoring */ @@ -54,28 +55,21 @@ private String groupName; private int orderID; //list of org.lamsfoundation.lams.usermanagement.dto.UserDTO - private List userList; + private List userList; private Integer groupUIID; + private boolean userBelongsToGroup = false; public GroupDTO() { - } - - /** - * Get the DTO for this group. Does not include the GroupBranchActivities as they will - * be in a separate array for Authoring. - * - * @param group - */ - @SuppressWarnings("unchecked") + public GroupDTO(Group group, boolean setupUserList) { groupID = group.getGroupId(); groupName = group.getGroupName(); orderID = group.getOrderId(); groupUIID = group.getGroupUIID(); - userList = new ArrayList(); + userList = new ArrayList<>(); if (setupUserList && group.getUsers() != null) { - Iterator iter = group.getUsers().iterator(); + Iterator iter = group.getUsers().iterator(); while (iter.hasNext()) { userList.add(((User) iter.next()).getUserBasicDTO()); } @@ -114,11 +108,19 @@ this.groupUIID = groupUIID; } - public List getUserList() { + public List getUserList() { return userList; } - public void setUserList(List userList) { + public void setUserList(List userList) { this.userList = userList; } + + public boolean isUserBelongsToGroup() { + return userBelongsToGroup; + } + + public void setUserBelongsToGroup(boolean userBelongsToGroup) { + this.userBelongsToGroup = userBelongsToGroup; + } } Index: lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java =================================================================== diff -u -r139e91caa1fc95af99802e31cb3a4b57ef7ebc5e -re325f88e2e856294ed9cde0f90303f84e2ceea8d --- lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 139e91caa1fc95af99802e31cb3a4b57ef7ebc5e) +++ lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -247,6 +247,8 @@ public static String USER_VALIDATION_REQUIRED_FIRST_LAST_NAME = "UserValidationFirstLastName"; public static String USER_VALIDATION_REQUIRED_EMAIL = "UserValidationEmail"; + + public static String RESTRICTED_DISPLAYING_OF_USER_NAMES_IN_GROUPS = "RestrictedGroupUserNames"; // LDEV-2747 public static String ENABLE_SERVER_REGISTRATION = "EnableServerRegistration"; Index: lams_learning/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r5b29d2ec94e51933e89af2401bc85f83d42307af -re325f88e2e856294ed9cde0f90303f84e2ceea8d --- lams_learning/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 5b29d2ec94e51933e89af2401bc85f83d42307af) +++ lams_learning/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -190,6 +190,6 @@ outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none button.kumalive.poll.chart.switch =Switch chart +label.learners ={0} learners - #======= End labels: Exported 184 labels for en AU ===== Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java =================================================================== diff -u -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db -re325f88e2e856294ed9cde0f90303f84e2ceea8d --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -46,13 +46,14 @@ import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.usermanagement.dto.UserBasicDTO; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.beans.factory.annotation.Autowired; 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.RequestParam; /** * @@ -94,19 +95,11 @@ /** * Perform the grouping for the users who are currently running the lesson. If force is set to true, then we should * be in preview mode, and we want to override the chosen grouping to make it group straight away. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException */ @RequestMapping("/performGrouping") public String performGrouping(@ModelAttribute GroupingForm groupingForm, HttpServletRequest request) throws IOException, ServletException { - + Integer currentUserId = LearningWebUtil.getUserId(); boolean forceGroup = WebUtil.readBooleanParam(request, GroupingController.PARAM_FORCE_GROUPING, false); // initialize service object @@ -118,85 +111,74 @@ } Long lessonId = learnerProgress.getLesson().getLessonId(); boolean groupingDone = learnerService.performGrouping(lessonId, activity.getActivityId(), - LearningWebUtil.getUserId(), forceGroup); + currentUserId, forceGroup); groupingForm.setPreviewLesson(learnerProgress.getLesson().isPreviewLesson()); groupingForm.setTitle(activity.getTitle()); groupingForm.setActivityID(activity.getActivityId()); - request.setAttribute(AttributeNames.PARAM_LESSON_ID, lessonId); + + SortedSet groups = new TreeSet<>(GroupDTO.GROUP_NAME_COMPARATOR); + Grouping grouping = ((GroupingActivity) activity).getCreateGrouping(); + if (grouping != null) { + for (Group group : grouping.getGroups()) { + GroupDTO groupDTO = new GroupDTO(group, true); + groupDTO.getUserList().sort(UserBasicDTO.USER_BASIC_DTO_COMPARATOR); + + //set isUserBelongsToGroup + for (UserBasicDTO userDto : groupDTO.getUserList()) { + if (userDto.getUserID().equals(currentUserId)) { + groupDTO.setUserBelongsToGroup(true); + break; + } + } + + groups.add(groupDTO); + } + } + request.setAttribute(GroupingController.GROUPS, groups); + request.setAttribute(GroupingController.TITLE, activity.getTitle()); + request.setAttribute(AttributeNames.PARAM_ACTIVITY_ID, activity.getActivityId()); + request.setAttribute(ConfigurationKeys.RESTRICTED_DISPLAYING_OF_USER_NAMES_IN_GROUPS, + Configuration.getAsBoolean(ConfigurationKeys.RESTRICTED_DISPLAYING_OF_USER_NAMES_IN_GROUPS)); + + //Load up the grouping information and forward to the jsp page to display all the groups and members. if (groupingDone) { request.setAttribute(GroupingController.FINISHED_BUTTON, Boolean.TRUE); - return viewGrouping(request, learnerProgress); - } + request.setAttribute(GroupingController.LOCAL_FILES, Boolean.FALSE); + ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); + request.setAttribute(GroupingController.FINISHED_BUTTON, new Boolean((mode == null) || !mode.isTeacher())); + + long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); + //find activity position within Learning Design and store it as request attribute + ActivityPositionDTO positionDTO = learnerService.getActivityPosition(activityId); + if (positionDTO != null) { + request.setAttribute(AttributeNames.ATTR_ACTIVITY_POSITION, positionDTO); + } + + return "grouping/show"; + + } else // forward to group choosing page if (((GroupingActivity) activity).getCreateGrouping().isLearnerChoiceGrouping()) { Long groupingId = ((GroupingActivity) activity).getCreateGrouping().getGroupingId(); Integer maxNumberOfLeaernersPerGroup = learnerService.calculateMaxNumberOfLearnersPerGroup(lessonId, groupingId); - LearnerChoiceGrouping grouping = (LearnerChoiceGrouping) learnerService.getGrouping(groupingId); - prepareGroupData(request); + LearnerChoiceGrouping groupingDb = (LearnerChoiceGrouping) learnerService.getGrouping(groupingId); request.setAttribute(GroupingController.MAX_LEARNERS_PER_GROUP, maxNumberOfLeaernersPerGroup); request.setAttribute(GroupingController.LOCAL_FILES, Boolean.FALSE); request.setAttribute(GroupingController.VIEW_STUDENTS_BEFORE_SELECTION, - grouping.getViewStudentsBeforeSelection()); + groupingDb.getViewStudentsBeforeSelection()); return "grouping/choose"; + + } else { + return "grouping/wait"; } - return "grouping/wait"; } /** - * Load up the grouping information and forward to the jsp page to display all the groups and members. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ -// @RequestMapping("/viewGroup") -// public String viewGrouping(HttpServletRequest request) throws IOException, ServletException { -// return viewGrouping(request, null); -// } - - @RequestMapping("/viewGroup") - public String viewGrouping(HttpServletRequest request, - @RequestParam(required = false) LearnerProgress learnerProgress) throws IOException, ServletException { - prepareGroupData(request); - request.setAttribute(GroupingController.LOCAL_FILES, Boolean.FALSE); - ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); - request.setAttribute(GroupingController.FINISHED_BUTTON, new Boolean((mode == null) || !mode.isTeacher())); - - long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); - //find activity position within Learning Design and store it as request attribute - ActivityPositionDTO positionDTO = learnerService.getActivityPosition(activityId); - if (positionDTO != null) { - request.setAttribute(AttributeNames.ATTR_ACTIVITY_POSITION, positionDTO); - } - - // make sure the lesson id is always in the request for the progress bar. - if (request.getAttribute(AttributeNames.PARAM_LESSON_ID) == null) { - if (learnerProgress == null) { - learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); - } - request.setAttribute(AttributeNames.PARAM_LESSON_ID, learnerProgress.getLesson().getLessonId()); - } - return "grouping/show"; - } - - /** * Complete the current tool activity and forward to the url of next activity in the learning design. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException */ @RequestMapping("/completeActivity") public String completeActivity(HttpServletRequest request, HttpServletResponse response) @@ -212,41 +194,7 @@ } /** - * Inserts into the request most of the data required by JSP page. This method is common for several pages. - * - * @param request - */ - @SuppressWarnings("unchecked") - @RequestMapping("/prepareGroupData") - private void prepareGroupData(HttpServletRequest request) { - - SortedSet groups = new TreeSet<>(GroupDTO.GROUP_NAME_COMPARATOR); - Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); - - Grouping grouping = ((GroupingActivity) activity).getCreateGrouping(); - if (grouping != null) { - for (Group group : grouping.getGroups()) { - GroupDTO groupDTO = new GroupDTO(group, true); - groupDTO.getUserList().sort(UserBasicDTO.USER_BASIC_DTO_COMPARATOR); - groups.add(groupDTO); - } - } - - request.setAttribute(GroupingController.GROUPS, groups); - request.setAttribute(GroupingController.TITLE, activity.getTitle()); - request.setAttribute(AttributeNames.PARAM_ACTIVITY_ID, activity.getActivityId()); - } - - /** * Responds to a learner's group choice. Might forward back to group choice page if the chosen group was full. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException */ @RequestMapping("/learnerChooseGroup") public String learnerChooseGroup(@ModelAttribute GroupingForm groupingForm, HttpServletRequest request) Index: lams_learning/web/grouping/choose.jsp =================================================================== diff -u -r45fd81e4ce1afac4b97ff45f2d6ce878644d137f -re325f88e2e856294ed9cde0f90303f84e2ceea8d --- lams_learning/web/grouping/choose.jsp (.../choose.jsp) (revision 45fd81e4ce1afac4b97ff45f2d6ce878644d137f) +++ lams_learning/web/grouping/choose.jsp (.../choose.jsp) (revision e325f88e2e856294ed9cde0f90303f84e2ceea8d) @@ -18,36 +18,28 @@ http://www.gnu.org/licenses/gpl.txt --%> - - <%@ include file="/common/taglibs.jsp"%> + - - <fmt:message key="label.view.groups.title" /> - + <fmt:message key="label.view.groups.title" /> - - - + - + + - - -