diff --git a/dspace/etc/dspace-web.xml b/dspace/etc/dspace-web.xml index 2c86290045..e006af000e 100644 --- a/dspace/etc/dspace-web.xml +++ b/dspace/etc/dspace-web.xml @@ -395,7 +395,7 @@ groups - /dspace-admin/groups + /tools/groups diff --git a/dspace/jsp/layout/navbar-admin.jsp b/dspace/jsp/layout/navbar-admin.jsp index c91c098b2b..e6d59b93aa 100644 --- a/dspace/jsp/layout/navbar-admin.jsp +++ b/dspace/jsp/layout/navbar-admin.jsp @@ -59,7 +59,7 @@ links.add("/dspace-admin/edit-epeople"); labels.add("Groups"); - links.add("/dspace-admin/groups"); + links.add("/tools/groups"); labels.add("Items"); links.add("/tools/edit-item"); diff --git a/dspace/jsp/tools/group-edit.jsp b/dspace/jsp/tools/group-edit.jsp new file mode 100644 index 0000000000..d638c9c44a --- /dev/null +++ b/dspace/jsp/tools/group-edit.jsp @@ -0,0 +1,96 @@ +<%-- + - group_edit.jsp + - + - $Id$ + - + - Copyright (c) 2002, Hewlett-Packard Company and Massachusetts + - Institute of Technology. All rights reserved. + - + - Redistribution and use in source and binary forms, with or without + - modification, are permitted provided that the following conditions are + - met: + - + - - Redistributions of source code must retain the above copyright + - notice, this list of conditions and the following disclaimer. + - + - - Redistributions in binary form must reproduce the above copyright + - notice, this list of conditions and the following disclaimer in the + - documentation and/or other materials provided with the distribution. + - + - - Neither the name of the Hewlett-Packard Company nor the name of the + - Massachusetts Institute of Technology nor the names of their + - contributors may be used to endorse or promote products derived from + - this software without specific prior written permission. + - + - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + - HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + - DAMAGE. + --%> + + +<%-- + - Show contents of a group (name, epeople) + - + - Attributes: + - group - group to be edited + - + - Returns: + - cancel - if user wants to cancel + - add_eperson - go to group_eperson_select.jsp to choose eperson + - change_name - alter name & redisplay + - eperson_remove - remove eperson & redisplay + --%> + +<%@ page contentType="text/html;charset=UTF-8" %> + +<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %> + +<%@ page import="org.dspace.eperson.EPerson" %> +<%@ page import="org.dspace.eperson.Group" %> + +<% + Group group = (Group) request.getAttribute("group"); + EPerson [] epeople = (EPerson []) request.getAttribute("members"); + +%> + + + +

Edit Group : <%=group.getName()%> (<%=group.getID()%>)

+ +

+

+ Name: + + +
+

+ + +

+
+

+ + +

Current Group Members

+ +
+ + + + +
diff --git a/dspace/jsp/tools/group-list.jsp b/dspace/jsp/tools/group-list.jsp new file mode 100644 index 0000000000..6ade92d08d --- /dev/null +++ b/dspace/jsp/tools/group-list.jsp @@ -0,0 +1,118 @@ +<%-- + - group_list.jsp + - + - $Id$ + - + - Copyright (c) 2002, Hewlett-Packard Company and Massachusetts + - Institute of Technology. All rights reserved. + - + - Redistribution and use in source and binary forms, with or without + - modification, are permitted provided that the following conditions are + - met: + - + - - Redistributions of source code must retain the above copyright + - notice, this list of conditions and the following disclaimer. + - + - - Redistributions in binary form must reproduce the above copyright + - notice, this list of conditions and the following disclaimer in the + - documentation and/or other materials provided with the distribution. + - + - - Neither the name of the Hewlett-Packard Company nor the name of the + - Massachusetts Institute of Technology nor the names of their + - contributors may be used to endorse or promote products derived from + - this software without specific prior written permission. + - + - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + - HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + - DAMAGE. + --%> + + +<%-- + - Display list of Groups, with 'edit' and 'delete' buttons next to them + - + - Attributes: + - + - groups - Group [] of groups to work on + --%> + +<%@ page contentType="text/html;charset=UTF-8" %> + +<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %> + +<%@ page import="org.dspace.eperson.EPerson" %> +<%@ page import="org.dspace.eperson.Group" %> + +<% + Group[] groups = + (Group[]) request.getAttribute("groups"); +%> + + + +

Group Editor

+ +

Note that you do not need to manually add users to the "anonymous" + group - all users are members implicitly.

+ +

Warning - if you try to delete a group that is referred to by an + authorization policy or is a workflow group you will get an internal + server error.

+ +

+

+ +
+

+ + + + + + + + + +<% + String row = "even"; + for (int i = 0; i < groups.length; i++) + { +%> + + + + + + + + +<% + row = (row.equals("odd") ? "even" : "odd"); + } +%> +
IDName  
<%= groups[i].getID() %> + <%= groups[i].getName() %> + + + + + +
+ + + +
diff --git a/dspace/src/org/dspace/app/webui/servlet/admin/GroupEditServlet.java b/dspace/src/org/dspace/app/webui/servlet/admin/GroupEditServlet.java index 21501b68dd..ac2eac9d7b 100644 --- a/dspace/src/org/dspace/app/webui/servlet/admin/GroupEditServlet.java +++ b/dspace/src/org/dspace/app/webui/servlet/admin/GroupEditServlet.java @@ -57,6 +57,7 @@ import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeManager; import org.dspace.authorize.ResourcePolicy; import org.dspace.content.Collection; +import org.dspace.core.Constants; import org.dspace.core.Context; import org.dspace.eperson.EPerson; import org.dspace.eperson.Group; @@ -72,131 +73,145 @@ public class GroupEditServlet extends DSpaceServlet HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { - // Find out if there's a group parameter - int groupID = UIUtil.getIntParameter(request, "group"); - Group g = null; - - if (groupID >= 0) - { - g = Group.find(c, groupID); - } - - if (g != null) - { - // Show edit page for group - request.setAttribute("group", g); - request.setAttribute("members", g.getMembers()); - - JSPManager.showJSP(request, response, "/dspace-admin/group-edit.jsp" ); - } - else - { - // show the main page (select groups) - showMainPage(c, request, response); - } + doDSPost(c, request, response); } protected void doDSPost(Context c, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { - String button = UIUtil.getSubmitButton(request, "submit"); - - if( button.equals("submit_edit") || button.equals("submit_add_eperson_cancel") ) + // Find out if there's a group parameter + int groupID = UIUtil.getIntParameter(request, "group_id"); + Group group = null; + + if (groupID >= 0) { + group = Group.find(c, groupID); + } + + // group is set + if (group != null) + { + // is this user authorized to edit this group? + AuthorizeManager.authorizeAction(c, group, Constants.ADD); + + String button = UIUtil.getSubmitButton(request, "submit"); + // just chosen a group to edit - get group and pass it to group-edit.jsp - Group group = Group.find(c, UIUtil.getIntParameter(request, "group_id")); + if( button.equals("submit_edit") || button.equals("submit_add_eperson_cancel") ) + { + request.setAttribute("group", group); + request.setAttribute("members", group.getMembers()); + JSPManager.showJSP(request, response, "/tools/group-edit.jsp" ); + } + + // alter group's name and return to group-edit.jsp + else if( button.equals("submit_change_name") ) + { + group.setName( request.getParameter("group_name") ); + group.update(); + + request.setAttribute("group", group); + request.setAttribute("members", group.getMembers()); + JSPManager.showJSP(request, response, "/tools/group-edit.jsp" ); + } + // update the members of the group + else if( button.equals("submit_members_update") ) + { + int [] eperson_ids = UIUtil.getIntParameters(request,"eperson_id"); + + if( eperson_ids != null ) + { + // now get members, and add new ones and remove missing ones + EPerson [] members = group.getMembers(); + + for(int x=0; x