Index: lams_admin/conf/language/ApplicationResources.properties =================================================================== diff -u -r594eae7c7c4a3fe379d52eafd68f65ebb554fbc7 -r83813a0305c0aac6ce942d61ce1ce3ccee5361ce --- lams_admin/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 594eae7c7c4a3fe379d52eafd68f65ebb554fbc7) +++ lams_admin/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 83813a0305c0aac6ce942d61ce1ce3ccee5361ce) @@ -123,6 +123,8 @@ role.LEARNER = Learner role.MONITOR = Monitor role.SYSADMIN = System Admin +label.member.of = Member of +label.with.roles = With roles #==================== Organisation Management Screen ======================# admin.organisation.management = Group/Subgroup Management Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java =================================================================== diff -u -ra7b0a98ccdef7a9308b07052506a7d3d8ecfa307 -r83813a0305c0aac6ce942d61ce1ce3ccee5361ce --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java (.../UserAction.java) (revision a7b0a98ccdef7a9308b07052506a7d3d8ecfa307) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java (.../UserAction.java) (revision 83813a0305c0aac6ce942d61ce1ce3ccee5361ce) @@ -24,6 +24,7 @@ /* $Id$ */ package org.lamsfoundation.lams.admin.web; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,11 +39,15 @@ import org.apache.struts.action.DynaActionForm; import org.lamsfoundation.lams.admin.AdminConstants; import org.lamsfoundation.lams.admin.service.AdminServiceProxy; +import org.lamsfoundation.lams.admin.web.dto.UserOrgRoleDTO; import org.lamsfoundation.lams.usermanagement.Organisation; +import org.lamsfoundation.lams.usermanagement.OrganisationState; import org.lamsfoundation.lams.usermanagement.OrganisationType; import org.lamsfoundation.lams.usermanagement.Role; import org.lamsfoundation.lams.usermanagement.SupportedLocale; import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.UserOrganisation; +import org.lamsfoundation.lams.usermanagement.UserOrganisationRole; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; @@ -120,6 +125,8 @@ userForm.set("password", null); SupportedLocale locale = user.getLocale(); userForm.set("localeId", locale.getLocaleId()); + // set user's organisations to display + request.setAttribute("userOrgRoles", getUserOrgRoles(user)); } else { // create a user try { String defaultLocale = Configuration.get(ConfigurationKeys.SERVER_LANGUAGE); @@ -147,6 +154,45 @@ return mapping.findForward("user"); } + // display user's organisations and roles in them + private List getUserOrgRoles(User user) { + + List uorDTOs = new ArrayList(); + List uos = service.getUserOrganisationsForUserByTypeAndStatus( + user.getLogin(), + OrganisationType.COURSE_TYPE, + OrganisationState.ACTIVE); + for (UserOrganisation uo : uos) { + UserOrgRoleDTO uorDTO = new UserOrgRoleDTO(); + List roles = new ArrayList(); + for (Object uor : uo.getUserOrganisationRoles()) + roles.add(((UserOrganisationRole)uor).getRole().getName()); + Collections.sort(roles); + uorDTO.setOrgName(uo.getOrganisation().getName()); + uorDTO.setRoles(roles); + List childDTOs = new ArrayList(); + List childuos = service.getUserOrganisationsForUserByTypeAndStatusAndParent( + user.getLogin(), + OrganisationType.CLASS_TYPE, + OrganisationState.ACTIVE, + uo.getOrganisation().getOrganisationId()); + for (UserOrganisation childuo : childuos) { + UserOrgRoleDTO childDTO = new UserOrgRoleDTO(); + List childroles = new ArrayList(); + for (Object uor : childuo.getUserOrganisationRoles()) + childroles.add(((UserOrganisationRole)uor).getRole().getName()); + Collections.sort(childroles); + childDTO.setOrgName(childuo.getOrganisation().getName()); + childDTO.setRoles(childroles); + childDTOs.add(childDTO); + } + uorDTO.setChildDTOs(childDTOs); + uorDTOs.add(uorDTO); + } + + return uorDTOs; + } + // determine whether to disable or delete user based on their lams data public ActionForward remove(ActionMapping mapping, ActionForm form, Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/dto/UserOrgRoleDTO.java =================================================================== diff -u --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/dto/UserOrgRoleDTO.java (revision 0) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/dto/UserOrgRoleDTO.java (revision 83813a0305c0aac6ce942d61ce1ce3ccee5361ce) @@ -0,0 +1,61 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.admin.web.dto; + +import java.util.List; + +/** + * @author jliew + * + */ +public class UserOrgRoleDTO { + + private String orgName; + private List roles; + private List childDTOs; + + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public List getChildDTOs() { + return childDTOs; + } + + public void setChildDTOs(List childDTOs) { + this.childDTOs = childDTOs; + } +} Index: lams_admin/web/user.jsp =================================================================== diff -u -rbaf684f0c64ff2686a9415c68c943ecf4184046d -r83813a0305c0aac6ce942d61ce1ce3ccee5361ce --- lams_admin/web/user.jsp (.../user.jsp) (revision baf684f0c64ff2686a9415c68c943ecf4184046d) +++ lams_admin/web/user.jsp (.../user.jsp) (revision 83813a0305c0aac6ce942d61ce1ce3ccee5361ce) @@ -29,97 +29,143 @@

 

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
*:
*:
*:
:
*:
*:
*:
:
:
:
:
:
:
:
:
:
:
:
: - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*:
*:
*:
:
*:
*:
*:
:
:
:
:
:
:
:
:
:
:
:
: + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
::
+ + + role.  + + +
-- + + + role.  + + +
+ +
- - - - - - - + +