Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r4d1e32385f6a6690ea7cbca001209fdb9721a59a -r6452b7bb53f1f0eb5a340fd488a733a9a6bd1415 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4d1e32385f6a6690ea7cbca001209fdb9721a59a) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 6452b7bb53f1f0eb5a340fd488a733a9a6bd1415) @@ -327,6 +327,13 @@ config.ldap.encrypt.password.from.browser =Encrypt Password From Browser config.ldap.search.results.page.size =Search Results Page Size error.numeric ={0} only accepts numeric characters +heading.users = Users +label.number.of.users = users. +heading.potential.users = Potential Users +label.number.of.potential.users = potential users. +msg.click.remove.user = Click a user to remove them. +msg.click.add.user = Click a user to add them. +msg.show.all.potential.users = Show all potential users. +label.next = Next - #======= End labels: Exported 320 labels for en AU ===== Index: lams_admin/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r4d1e32385f6a6690ea7cbca001209fdb9721a59a -r6452b7bb53f1f0eb5a340fd488a733a9a6bd1415 --- lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 4d1e32385f6a6690ea7cbca001209fdb9721a59a) +++ lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 6452b7bb53f1f0eb5a340fd488a733a9a6bd1415) @@ -327,6 +327,13 @@ config.ldap.encrypt.password.from.browser =Encrypt Password From Browser config.ldap.search.results.page.size =Search Results Page Size error.numeric ={0} only accepts numeric characters +heading.users = Users +label.number.of.users = users. +heading.potential.users = Potential Users +label.number.of.potential.users = potential users. +msg.click.remove.user = Click a user to remove them. +msg.click.add.user = Click a user to add them. +msg.show.all.potential.users = Show all potential users. +label.next = Next - #======= End labels: Exported 320 labels for en AU ===== Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserOrgAction.java =================================================================== diff -u -r4a2728da7ea82a98b92d3a8b08feb6efa4023b7d -r6452b7bb53f1f0eb5a340fd488a733a9a6bd1415 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserOrgAction.java (.../UserOrgAction.java) (revision 4a2728da7ea82a98b92d3a8b08feb6efa4023b7d) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserOrgAction.java (.../UserOrgAction.java) (revision 6452b7bb53f1f0eb5a340fd488a733a9a6bd1415) @@ -24,10 +24,6 @@ /* $Id$ */ package org.lamsfoundation.lams.admin.web; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -39,15 +35,9 @@ import org.apache.struts.action.DynaActionForm; import org.lamsfoundation.lams.admin.service.AdminServiceProxy; import org.lamsfoundation.lams.usermanagement.Organisation; -import org.lamsfoundation.lams.usermanagement.OrganisationType; -import org.lamsfoundation.lams.usermanagement.Role; -import org.lamsfoundation.lams.usermanagement.User; -import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; -import org.lamsfoundation.lams.web.session.SessionManager; -import org.lamsfoundation.lams.web.util.AttributeNames; /** * @author Jun-Dir Liew @@ -100,57 +90,12 @@ } Integer orgType = organisation.getOrganisationType().getOrganisationTypeId(); request.setAttribute("orgType",orgType); - - // get list of users in org - Integer userId = ((UserDTO)SessionManager.getSession().getAttribute(AttributeNames.USER)).getUserID(); - List users = new ArrayList(); - Organisation orgOfCourseAdmin = (orgType.equals(OrganisationType.CLASS_TYPE)) ? parentOrg : organisation; - if(request.isUserInRole(Role.SYSADMIN) - || service.isUserGlobalGroupAdmin()){ - users = service.findAll(User.class); - }else if(service.isUserInRole(userId,orgOfCourseAdmin.getOrganisationId(),Role.GROUP_ADMIN) - || service.isUserInRole(userId,orgOfCourseAdmin.getOrganisationId(),Role.GROUP_MANAGER)){ - if(orgOfCourseAdmin.getCourseAdminCanBrowseAllUsers()){ - users = service.findAll(User.class); - }else if(orgType.equals(OrganisationType.CLASS_TYPE)){ - users = service.getUsersFromOrganisation(parentOrg.getOrganisationId()); - }else if(orgType.equals(OrganisationType.COURSE_TYPE)){ - users = service.getUsersFromOrganisation(orgId); - } - }else{ - request.setAttribute("errorName","UserOrgAction"); - request.setAttribute("errorMessage",messageService.getMessage("error.authorisation")); - return mapping.findForward("error"); - } - users = removeDisabledUsers(users); - Collections.sort(users); - request.setAttribute("userlist",users); // create form object DynaActionForm userOrgForm = (DynaActionForm)form; userOrgForm.set("orgId",orgId); userOrgForm.set("orgName",orgName); - - // create list of userids, members of this org - List memberUsers = service.getUsersFromOrganisation(orgId); - String[] userIds = new String[memberUsers.size()]; - for(int i=0; i + + + + +
  • "> ( ) -
  • +
    \ No newline at end of file Index: lams_admin/web/userorg.jsp =================================================================== diff -u -r1e2078bad6f3b9d51ce7fdd217728a14bb801e3f -r6452b7bb53f1f0eb5a340fd488a733a9a6bd1415 --- lams_admin/web/userorg.jsp (.../userorg.jsp) (revision 1e2078bad6f3b9d51ce7fdd217728a14bb801e3f) +++ lams_admin/web/userorg.jsp (.../userorg.jsp) (revision 6452b7bb53f1f0eb5a340fd488a733a9a6bd1415) @@ -1,15 +1,114 @@ <%@ include file="/taglibs.jsp"%> - + - - + +

    @@ -27,47 +126,47 @@

     

    +
    +

    -
    - - - - - - - - +

    +
    0
    +

    + +

    +
    +
    +
    +
    - - - - - - - - - +

     

    - - - +

    +

    + +

    +
    0
    + +

    + : or +

    + +
    +
    +
    +
    -
    - - - - - - - - - -
    - - - -
    - \ No newline at end of file +

     

    + +
    + + + + + +
    + +

     

    Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java =================================================================== diff -u -r3920fca37b6f52d187d97b632a22adc545ae0492 -r6452b7bb53f1f0eb5a340fd488a733a9a6bd1415 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java (.../IUserManagementService.java) (revision 3920fca37b6f52d187d97b632a22adc545ae0492) +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java (.../IUserManagementService.java) (revision 6452b7bb53f1f0eb5a340fd488a733a9a6bd1415) @@ -400,4 +400,52 @@ public List getActiveCourseIdsByUser(Integer userId, boolean isSysadmin); public List getArchivedCourseIdsByUser(Integer userId, boolean isSysadmin); + + /** + * Search users across login, first name, last name and email fields using the search term. + * Filters out disabled users. + * @param term + * @return list of Users + */ + public List searchUserSingleTerm(String term); + + /** + * Search users across login, first name, last name and email fields using the search term. + * Filters out disabled users, and users that are members of filteredOrg. + * @param term + * @param filteredOrgId + * @return list of Users + */ + public List searchUserSingleTerm(String term, Integer filteredOrgId); + + /** + * Search user members in orgId across login, first name, last name and email fields using the search term. + * Filters out disabled users, and users that are members of filteredOrg. + * @param term + * @param orgId + * @param filteredOrgId + * @return list of Users + */ + public List searchUserSingleTerm(String term, Integer orgId, Integer filteredOrgId); + + /** + * Get all users, except for disabled users. + * @return list of Users + */ + public List getAllUsers(); + + /** + * Get all users, except for disabled users and users that are members of filteredOrg. + * @param optionalOrgId + * @return list of Users + */ + public List getAllUsers(Integer filteredOrgId); + + /** + * Get all users in orgId, except for users that are members of filteredOrg. + * @param orgId + * @param filteredOrgId + * @return list of Users + */ + public List getUsersFromOrganisation(Integer orgId, Integer filteredOrgId); } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java =================================================================== diff -u -r07578aaa7f526c0c1b537c127cf5f88e0410d472 -r6452b7bb53f1f0eb5a340fd488a733a9a6bd1415 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision 07578aaa7f526c0c1b537c127cf5f88e0410d472) +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision 6452b7bb53f1f0eb5a340fd488a733a9a6bd1415) @@ -331,13 +331,10 @@ * @see org.lamsfoundation.lams.usermanagement.service.IUserManagementService#getUsersFromOrganisation(int) */ public List getUsersFromOrganisation(Integer orgId) { - List list = new ArrayList(); - Iterator i = baseDAO.findByProperty(UserOrganisation.class,"organisation.organisationId",orgId).iterator(); - while (i.hasNext()) { - UserOrganisation userOrganisation = (UserOrganisation) i.next(); - list.add(userOrganisation.getUser()); - } - return list; + String query = "select uo.user from UserOrganisation uo" + + " where uo.organisation.organisationId=" + orgId + + " order by uo.user.login"; + return baseDAO.find(query); } @@ -982,4 +979,70 @@ return dtoList; } + public List searchUserSingleTerm(String term) { + String query = "select u from User u where" + + " (u.login like '%" + term + "%'" + + " or u.firstName like '%" + term + "%'" + + " or u.lastName like '%" + term + "%'" + + " or u.email like '%" + term + "%')" + + " and u.disabledFlag=0" + + " order by u.login"; + List list = baseDAO.find(query); + return list; + } + + public List searchUserSingleTerm(String term, Integer filteredOrgId) { + String query = "select u from User u where" + + " (u.login like '%" + term + "%'" + + " or u.firstName like '%" + term + "%'" + + " or u.lastName like '%" + term + "%'" + + " or u.email like '%" + term + "%')" + + " and u.disabledFlag=0" + + " and u.userId not in" + + " (select uo.user.userId from UserOrganisation uo" + + " where uo.organisation.organisationId=" + filteredOrgId +")" + + " order by u.login"; + List list = baseDAO.find(query); + return list; + } + + public List searchUserSingleTerm(String term, Integer orgId, Integer filteredOrgId) { + String query = "select uo.user from UserOrganisation uo where" + + " (uo.user.login like '%" + term + "%'" + + " or uo.user.firstName like '%" + term + "%'" + + " or uo.user.lastName like '%" + term + "%'" + + " or uo.user.email like '%" + term + "%')" + + " and uo.user.disabledFlag=0" + + " and uo.organisation.organisationId=" + orgId + + " and uo.user.userId not in" + + " (select uo.user.userId from UserOrganisation uo" + + " where uo.organisation.organisationId=" + filteredOrgId +")" + + " order by uo.user.login"; + List list = baseDAO.find(query); + return list; + } + + public List getAllUsers() { + String query = "from User u where u.disabledFlag=0 order by u.login"; + return baseDAO.find(query); + } + + public List getAllUsers(Integer filteredOrgId) { + String query = "from User u where u.disabledFlag=0" + + " and u.userId not in" + + " (select uo.user.userId from UserOrganisation uo" + + " where uo.organisation.organisationId=" + filteredOrgId +")" + + " order by u.login"; + return baseDAO.find(query); + } + + public List getUsersFromOrganisation(Integer orgId, Integer filteredOrgId) { + String query = "select uo.user from UserOrganisation uo" + + " where uo.organisation.organisationId=" + orgId + + " and uo.user.userId not in" + + " (select uo.user.userId from UserOrganisation uo" + + " where uo.organisation.organisationId=" + filteredOrgId +")" + + " order by uo.user.login"; + return baseDAO.find(query); + } } \ No newline at end of file