Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_admin/conf/language/lams/ApplicationResources.properties,v diff -u -r1.22 -r1.23 --- lams_admin/conf/language/lams/ApplicationResources.properties 4 Dec 2007 03:56:34 -0000 1.22 +++ lams_admin/conf/language/lams/ApplicationResources.properties 5 Dec 2007 05:52:49 -0000 1.23 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_admin/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.21 -r1.22 --- lams_admin/conf/language/lams/ApplicationResources_en_AU.properties 4 Dec 2007 03:56:34 -0000 1.21 +++ lams_admin/conf/language/lams/ApplicationResources_en_AU.properties 5 Dec 2007 05:52:49 -0000 1.22 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserOrgAction.java,v diff -u -r1.16 -r1.17 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserOrgAction.java 29 Nov 2006 03:59:22 -0000 1.16 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserOrgAction.java 5 Dec 2007 05:52:49 -0000 1.17 @@ -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 - + - - + +

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

 

+
+

-
- - - - - - - - +

+
0
+

+ +

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

 

- - - +

+

+ +

+
0
+ +

+ : or +

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

 

+ +
+ + + + + +
+ +

 

Index: lams_admin/web/user/basiclist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_admin/web/user/basiclist.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_admin/web/user/basiclist.jsp 5 Dec 2007 05:52:49 -0000 1.1 @@ -0,0 +1,7 @@ +<%@ include file="/taglibs.jsp"%> + + + + +
  • "> ( ) -
  • +
    \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java,v diff -u -r1.51 -r1.52 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java 2 Nov 2007 01:22:48 -0000 1.51 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java 5 Dec 2007 05:52:50 -0000 1.52 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java,v diff -u -r1.84 -r1.85 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java 12 Nov 2007 23:30:47 -0000 1.84 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java 5 Dec 2007 05:52:50 -0000 1.85 @@ -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