Added Lieven Droogmans' patch and fixed regression to dspace.cfg

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1075 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Jim Downing
2004-12-13 16:59:46 +00:00
parent 185e8589c4
commit 44d920f667
23 changed files with 291 additions and 84 deletions

14
dspace/CHANGES Normal file
View File

@@ -0,0 +1,14 @@
1.2.1-beta1
===========
(Scott Yeadon)
- Added browse and search thumbnail display (currently configurable on a repository, not collection, basis); ability to turn off thumbnails on display-item page
- Added script to bin directory by Cody Green to assist with migrating items from one DSpace instance to another (removes handle files and updates DC metadata of exported items)
(Jim Downing)
- Cleaned up several loose resource cleanups to cure resource leakage under heavy loads.
(Austin Kim)
- Which metadata fields are indexed by lucene is now configurable.
(Dave Stuve)
- Oracle compatibility added

View File

@@ -1,4 +1,4 @@
DSpace Version 1.2.1-beta1, 20-September-2004 DSpace Version 1.2.1-beta2, 12-November-2004
Installation instructions are included in the 'dspace-docs' download, Installation instructions are included in the 'dspace-docs' download,
available from: available from:
@@ -7,9 +7,13 @@ http://sourceforge.net/projects/dspace/
Documentation may be viewed online at dspace.org, but these pertain to the Documentation may be viewed online at dspace.org, but these pertain to the
most recent stable release; the installation instructions for this beta most recent stable release; the installation instructions for this beta
may be different so you are encouraged to download the dspace-docs may be different so you are encouraged to obtain the docs from cvs, or to
package corresponding to this beta from the above SourceForge page and refer download the latest documentation snapshot from
any problems to the dspace-tech@lists.sourceforge.net mailing list.
http://dspace.sourceforge.net/doc-snapshots/
Please refer any further problems to the dspace-tech@lists.sourceforge.net
mailing list.
http://sourceforge.net/mail/?group_id=19984 http://sourceforge.net/mail/?group_id=19984

View File

@@ -35,6 +35,10 @@ config.template.oaicat.properties = /dspace/config/oaicat.properties
##### Database settings ##### ##### Database settings #####
# Database name ("oracle", or "postgres")
db.name = postgres
#db.name = oracle
# URL for connecting to database # URL for connecting to database
db.url = jdbc:postgresql://localhost:5432/dspace db.url = jdbc:postgresql://localhost:5432/dspace
@@ -129,6 +133,21 @@ webui.cert.autoregister = true
# Should the submit UI block submissions marked as theses? # Should the submit UI block submissions marked as theses?
webui.submit.blocktheses = false webui.submit.blocktheses = false
# whether to display thumbnails on browse and search results pages (1.2+)
webui.browse.thumbnail.show = false
# max dimensions of the browse/search thumbs. Must be <= thumbnail.maxwidth
# and thumbnail.maxheight. Only need to be set if required to be smaller than
# dimension of thumbnails generated by mediafilter (1.2+)
#webui.browse.thumbnail.maxheight = 80
#webui.browse.thumbnail.maxwidth = 80
# whether to display the thumb against each bitstream (1.2+)
webui.item.thumbnail.show = true
# where should clicking on a thumbnail from browse/search take the user
# Only values currently supported are "item" and "bitstream"
#webui.browse.thumbnail.linkbehaviour = item
##### SFX Server ##### ##### SFX Server #####

View File

@@ -360,7 +360,7 @@
<servlet-mapping> <servlet-mapping>
<servlet-name>collection-wizard</servlet-name> <servlet-name>collection-wizard</servlet-name>
<url-pattern>/dspace-admin/collection-wizard</url-pattern> <url-pattern>/tools/collection-wizard</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping> <servlet-mapping>
@@ -368,11 +368,17 @@
<url-pattern>/dspace-admin/dc-registry</url-pattern> <url-pattern>/dspace-admin/dc-registry</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping>
<servlet-name>edit-communities</servlet-name>
<url-pattern>/tools/edit-communities</url-pattern>
</servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>edit-communities</servlet-name> <servlet-name>edit-communities</servlet-name>
<url-pattern>/dspace-admin/edit-communities</url-pattern> <url-pattern>/dspace-admin/edit-communities</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>edit-epeople</servlet-name> <servlet-name>edit-epeople</servlet-name>
<url-pattern>/dspace-admin/edit-epeople</url-pattern> <url-pattern>/dspace-admin/edit-epeople</url-pattern>

View File

@@ -215,10 +215,10 @@
<th> <th>
</tr> </tr>
<% if( admin_button ) { %> <% if( editor_button ) { %>
<tr> <tr>
<td class="standard" align="center"> <td class="standard" align="center">
<form method=POST action="<%=request.getContextPath()%>/dspace-admin/edit-communities"> <form method=POST action="<%=request.getContextPath()%>/tools/edit-communities">
<input type="hidden" name="collection_id" value="<%= collection.getID() %>"> <input type="hidden" name="collection_id" value="<%= collection.getID() %>">
<input type="hidden" name="community_id" value="<%= community.getID() %>"> <input type="hidden" name="community_id" value="<%= community.getID() %>">
<input type="hidden" name="action" value="<%= EditCommunitiesServlet.START_EDIT_COLLECTION %>"> <input type="hidden" name="action" value="<%= EditCommunitiesServlet.START_EDIT_COLLECTION %>">
@@ -228,7 +228,7 @@
</tr> </tr>
<% } %> <% } %>
<% if( editor_button ) { %> <% if( admin_button ) { %>
<tr> <tr>
<td class="standard" align="center"> <td class="standard" align="center">
<form method=POST action="<%=request.getContextPath()%>/tools/itemmap"> <form method=POST action="<%=request.getContextPath()%>/tools/itemmap">
@@ -252,11 +252,11 @@
<dspace:popup page="/help/collection-admin.html">Admin Help...</dspace:popup> <dspace:popup page="/help/collection-admin.html">Admin Help...</dspace:popup>
</td> </td>
</tr> </tr>
<% } %>
</table> </table>
</td> </td>
</tr> </tr>
<% } %>
</table> </table>
<% } %> <% } %>

View File

@@ -72,8 +72,12 @@
request.getAttribute("last.submitted.titles"); request.getAttribute("last.submitted.titles");
String[] lastSubmittedURLs = (String[]) String[] lastSubmittedURLs = (String[])
request.getAttribute("last.submitted.urls"); request.getAttribute("last.submitted.urls");
Boolean admin_b = (Boolean)request.getAttribute("admin_button"); Boolean editor_b = (Boolean)request.getAttribute("editor_button");
boolean admin_button = (admin_b == null ? false : admin_b.booleanValue()); boolean editor_button = (editor_b == null ? false : editor_b.booleanValue());
Boolean add_b = (Boolean)request.getAttribute("add_button");
boolean add_button = (add_b == null ? false : add_b.booleanValue());
Boolean remove_b = (Boolean)request.getAttribute("remove_button");
boolean remove_button = (remove_b == null ? false : remove_b.booleanValue());
// Put the metadata values into guaranteed non-null variables // Put the metadata values into guaranteed non-null variables
@@ -156,7 +160,7 @@
</tr> </tr>
</table> </table>
</form> </form>
<%= intro %> <%= intro %>
<% <%
@@ -172,8 +176,25 @@
{ {
%> %>
<LI> <LI>
<A HREF="<%= request.getContextPath() %>/handle/<%= collections[i].getHandle() %>"> <table>
<%= collections[i].getMetadata("name") %></A> <tr>
<td>
<A HREF="<%= request.getContextPath() %>/handle/<%= collections[i].getHandle() %>">
<%= collections[i].getMetadata("name") %></A>
</td>
<% if (remove_button) { %>
<td>
<form method=POST action="<%=request.getContextPath()%>/tools/edit-communities">
<input type="hidden" name="parent_community_id" value="<%= community.getID() %>">
<input type="hidden" name="community_id" value="<%= community.getID() %>">
<input type="hidden" name="collection_id" value="<%= collections[i].getID() %>">
<input type="hidden" name="action" value="<%=EditCommunitiesServlet.START_DELETE_COLLECTION%>">
<input type="image" src="<%= request.getContextPath() %>/image/remove.gif">
</form>
</td>
<% } %>
</tr>
</table>
<P class="collectionDescription"><%= collections[i].getMetadata("short_description") %></P> <P class="collectionDescription"><%= collections[i].getMetadata("short_description") %></P>
</LI> </LI>
<% <%
@@ -196,8 +217,24 @@
{ {
%> %>
<LI> <LI>
<A HREF="<%= request.getContextPath() %>/handle/<%= subcommunities[j].getHandle() %>"> <table>
<%= subcommunities[j].getMetadata("name") %></A> <tr>
<td>
<A HREF="<%= request.getContextPath() %>/handle/<%= subcommunities[j].getHandle() %>">
<%= subcommunities[j].getMetadata("name") %></A>
</td>
<% if (remove_button) { %>
<td>
<form method=POST action="<%=request.getContextPath()%>/tools/edit-communities">
<input type="hidden" name="parent_community_id" value="<%= community.getID() %>">
<input type="hidden" name="community_id" value="<%= subcommunities[j].getID() %>">
<input type="hidden" name="action" value="<%=EditCommunitiesServlet.START_DELETE_COMMUNITY%>">
<input type="image" src="<%= request.getContextPath() %>/image/remove.gif">
</form>
</td>
<% } %>
</tr>
</table>
<P class="collectionDescription"><%= subcommunities[j].getMetadata("short_description") %></P> <P class="collectionDescription"><%= subcommunities[j].getMetadata("short_description") %></P>
</LI> </LI>
<% <%
@@ -211,7 +248,7 @@
<P class="copyrightText"><%= copyright %></P> <P class="copyrightText"><%= copyright %></P>
<dspace:sidebar> <dspace:sidebar>
<% if(admin_button) // admin edit button <% if(editor_button || add_button) // edit button(s)
{ %> { %>
<table class=miscTable align=center> <table class=miscTable align=center>
<tr> <tr>
@@ -224,20 +261,24 @@
</tr> </tr>
<tr> <tr>
<td class="standard" align="center"> <td class="standard" align="center">
<form method=POST action="<%=request.getContextPath()%>/dspace-admin/edit-communities"> <% if(editor_button) { %>
<form method=POST action="<%=request.getContextPath()%>/tools/edit-communities">
<input type="hidden" name="community_id" value="<%= community.getID() %>"> <input type="hidden" name="community_id" value="<%= community.getID() %>">
<input type="hidden" name="action" value="<%=EditCommunitiesServlet.START_EDIT_COMMUNITY%>"> <input type="hidden" name="action" value="<%=EditCommunitiesServlet.START_EDIT_COMMUNITY%>">
<input type="submit" value="Edit..."> <input type="submit" value="Edit...">
</form> </form>
<form method=POST action="<%=request.getContextPath()%>/dspace-admin/collection-wizard"> <% } %>
<input type="hidden" name="community_id" value="<%= community.getID() %>"> <% if(add_button) { %>
<input type="submit" value="Create collection"> <form method=POST action="<%=request.getContextPath()%>/tools/collection-wizard">
<input type="hidden" name="community_id" value="<%= community.getID() %>">
<input type="submit" value="Create collection">
</form> </form>
<form method=POST action="<%=request.getContextPath()%>/dspace-admin/edit-communities"> <form method=POST action="<%=request.getContextPath()%>/tools/edit-communities">
<input type="hidden" name="action" value="<%= EditCommunitiesServlet.START_CREATE_COMMUNITY%>"> <input type="hidden" name="action" value="<%= EditCommunitiesServlet.START_CREATE_COMMUNITY%>">
<input type="hidden" name="parent_community_id" value="<%= community.getID() %>"> <input type="hidden" name="parent_community_id" value="<%= community.getID() %>">
<input type="submit" name="submit" value="Create Sub-community"> <input type="submit" name="submit" value="Create Sub-community">
</form> </form>
<% } %>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@@ -67,7 +67,7 @@
</tr> </tr>
</table> </table>
<form action="<%= request.getContextPath() %>/dspace-admin/collection-wizard" method=post enctype="multipart/form-data"> <form action="<%= request.getContextPath() %>/tools/collection-wizard" method=post enctype="multipart/form-data">
<table> <table>
<tr> <tr>
<td><P class="submitFormLabel">Name:</P></td> <td><P class="submitFormLabel">Name:</P></td>

View File

@@ -74,7 +74,7 @@
<P>You can leave as many fields blank as you like.</P> <P>You can leave as many fields blank as you like.</P>
<form method=POST action="<%= request.getContextPath() %>/dspace-admin/collection-wizard"> <form method=POST action="<%= request.getContextPath() %>/tools/collection-wizard">
<center><table class="miscTable"> <center><table class="miscTable">
<tr> <tr>
<th class="oddRowOddCol"><strong>Dublin Core Field</strong></th> <th class="oddRowOddCol"><strong>Dublin Core Field</strong></th>

View File

@@ -127,7 +127,7 @@ other collections to this collection (subject to authorization from that collect
<P>You can change this later using the relevant sections of the DSpace admin UI.</P> <P>You can change this later using the relevant sections of the DSpace admin UI.</P>
<form action="<%= request.getContextPath() %>/dspace-admin/collection-wizard" method=post> <form action="<%= request.getContextPath() %>/tools/collection-wizard" method=post>
<center> <center>
<table> <table>

View File

@@ -58,7 +58,7 @@
<H1>Describe the Collection</H1> <H1>Describe the Collection</H1>
<form action="<%= request.getContextPath() %>/dspace-admin/collection-wizard" method=post> <form action="<%= request.getContextPath() %>/tools/collection-wizard" method=post>
<P>Please check the boxes next to the statements that apply to the collection. <P>Please check the boxes next to the statements that apply to the collection.
<dspace:popup page="/help/site-admin.html#createcollection">More Help...</dspace:popup></P> <dspace:popup page="/help/site-admin.html#createcollection">More Help...</dspace:popup></P>

BIN
dspace/jsp/image/remove.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

View File

@@ -55,7 +55,7 @@
List links = new LinkedList(); List links = new LinkedList();
labels.add("Communities/<br>Collections"); labels.add("Communities/<br>Collections");
links.add("/dspace-admin/edit-communities"); links.add("/tools/edit-communities");
labels.add("E-people"); labels.add("E-people");
links.add("/dspace-admin/edit-epeople"); links.add("/dspace-admin/edit-epeople");

View File

@@ -58,7 +58,7 @@
Community community = (Community) request.getAttribute("community"); Community community = (Community) request.getAttribute("community");
%> %>
<dspace:layout title="Delete Collection" navbar="admin" locbar="link" parentlink="/dspace-admin" parenttitle="Administer"> <dspace:layout title="Delete Collection" navbar="admin" locbar="link" parentlink="/tools" parenttitle="Administer">
<H1>Delete Collection: <%= collection.getID() %></H1> <H1>Delete Collection: <%= collection.getID() %></H1>

View File

@@ -56,7 +56,7 @@
Community community = (Community) request.getAttribute("community"); Community community = (Community) request.getAttribute("community");
%> %>
<dspace:layout title="Delete Community" navbar="admin" locbar="link" parentlink="/dspace-admin" parenttitle="Administer"> <dspace:layout title="Delete Community" navbar="admin" locbar="link" parentlink="/tools" parenttitle="Administer">
<H1>Delete Community: <%= community.getID() %></H1> <H1>Delete Community: <%= community.getID() %></H1>

View File

@@ -61,6 +61,8 @@
<% <%
Collection collection = (Collection) request.getAttribute("collection"); Collection collection = (Collection) request.getAttribute("collection");
Community community = (Community) request.getAttribute("community"); Community community = (Community) request.getAttribute("community");
Boolean admin_b = (Boolean)request.getAttribute("admin_button");
boolean admin_button = (admin_b == null ? false : admin_b.booleanValue());
String name = ""; String name = "";
String shortDesc = ""; String shortDesc = "";
@@ -138,6 +140,7 @@
<H1>Create Collection</H1> <H1>Create Collection</H1>
<% } else { %> <% } else { %>
<H1>Edit Collection <%= collection.getHandle() %></H1> <H1>Edit Collection <%= collection.getHandle() %></H1>
<% if(admin_button ) { %>
<center> <center>
<table width="70%"> <table width="70%">
<tr> <tr>
@@ -152,9 +155,10 @@
</tr> </tr>
</table> </table>
</center> </center>
<% } %>
<% } %> <% } %>
<form method=POST action="<%= request.getContextPath() %>/dspace-admin/edit-communities"> <form method=POST action="<%= request.getContextPath() %>/tools/edit-communities">
<table> <table>
<%-- =========================================================== <%-- ===========================================================
Basic metadata Basic metadata
@@ -226,6 +230,7 @@
<tr><td>&nbsp;</td></tr> <tr><td>&nbsp;</td></tr>
<tr><td colspan=2><center><h3>Submission Workflow</h3></center></td></tr> <tr><td colspan=2><center><h3>Submission Workflow</h3></center></td></tr>
<% if(admin_button ) { %>
<%-- =========================================================== <%-- ===========================================================
Collection Submitters Collection Submitters
=========================================================== --%> =========================================================== --%>
@@ -274,6 +279,7 @@
<% } %> <% } %>
</td> </td>
</tr> </tr>
<% } %>
<%-- =========================================================== <%-- ===========================================================
Item template Item template
=========================================================== --%> =========================================================== --%>
@@ -288,6 +294,7 @@
<% } %> <% } %>
</td> </td>
</tr> </tr>
<% if(admin_button ) { %>
<%-- =========================================================== <%-- ===========================================================
Edit collection's policies Edit collection's policies
=========================================================== --%> =========================================================== --%>
@@ -297,7 +304,7 @@
<input type="submit" name="submit_authorization_edit" value="Edit..."> <input type="submit" name="submit_authorization_edit" value="Edit...">
</td> </td>
</tr> </tr>
<% } %>
</table> </table>

View File

@@ -58,6 +58,8 @@
<% <%
Community community = (Community) request.getAttribute("community"); Community community = (Community) request.getAttribute("community");
int parentID = UIUtil.getIntParameter(request, "parent_community_id"); int parentID = UIUtil.getIntParameter(request, "parent_community_id");
Boolean admin_b = (Boolean)request.getAttribute("admin_button");
boolean admin_button = (admin_b == null ? false : admin_b.booleanValue());
String name = ""; String name = "";
String shortDesc = ""; String shortDesc = "";
@@ -105,6 +107,7 @@
{ {
%> %>
<H1>Edit Community <%= community.getHandle() %></H1> <H1>Edit Community <%= community.getHandle() %></H1>
<% if(admin_button ) { %>
<center> <center>
<table width="70%"> <table width="70%">
<tr> <tr>
@@ -118,6 +121,7 @@
</tr> </tr>
</table> </table>
</center> </center>
<% } %>
<% <%
} }
%> %>
@@ -184,6 +188,7 @@
<% } %> <% } %>
</td> </td>
</tr> </tr>
<% if(admin_button ) { %>
<%-- =========================================================== <%-- ===========================================================
Edit community's policies Edit community's policies
=========================================================== --%> =========================================================== --%>
@@ -193,6 +198,7 @@
<input type="submit" name="submit_authorization_edit" value="Edit..."> <input type="submit" name="submit_authorization_edit" value="Edit...">
</td> </td>
</tr> </tr>
<% } %>
</table> </table>

View File

@@ -349,11 +349,25 @@ public class HandleServlet extends DSpaceServlet
String[] itemLinks = getItemURLs(context, items); String[] itemLinks = getItemURLs(context, items);
// can they admin this collection? // is the user a COMMUNITY_EDITOR?
if(AuthorizeManager.authorizeActionBoolean(context, community, Constants.WRITE)) if(community.canEditBoolean())
{ {
// set a variable to create an edit button // set a variable to create an edit button
request.setAttribute("admin_button", new Boolean(true)); request.setAttribute("editor_button", new Boolean(true));
}
// can they add to this community?
if(AuthorizeManager.authorizeActionBoolean(context, community, Constants.ADD))
{
// set a variable to create an edit button
request.setAttribute("add_button", new Boolean(true));
}
// can they remove from this community?
if(AuthorizeManager.authorizeActionBoolean(context, community, Constants.REMOVE))
{
// set a variable to create an edit button
request.setAttribute("remove_button", new Boolean(true));
} }
// Forward to community home page // Forward to community home page
@@ -438,17 +452,17 @@ public class HandleServlet extends DSpaceServlet
{ {
subscribed = Subscribe.isSubscribed(context, e, collection); subscribed = Subscribe.isSubscribed(context, e, collection);
// can they admin this collection? // is the user a COLLECTION_EDITOR?
if(AuthorizeManager.authorizeActionBoolean(context, collection, Constants.WRITE)) if(collection.canEditBoolean())
{ {
// set a variable to create an edit button // set a variable to create an edit button
request.setAttribute("admin_button", new Boolean(true)); request.setAttribute("editor_button", new Boolean(true));
} }
// is the user a COLLECTION_EDITOR? // can they admin this collection?
if(AuthorizeManager.authorizeActionBoolean(context, collection, Constants.COLLECTION_ADMIN)) if(AuthorizeManager.authorizeActionBoolean(context, collection, Constants.COLLECTION_ADMIN))
{ {
request.setAttribute("editor_button", new Boolean(true)); request.setAttribute("admin_button", new Boolean(true));
// give them a button to manage submitter list // give them a button to manage submitter list
// what group is the submitter? // what group is the submitter?

View File

@@ -641,7 +641,7 @@ public class CollectionWizardServlet extends DSpaceServlet
Community[] communities = collection.getCommunities(); Community[] communities = collection.getCommunities();
request.setAttribute("community", communities[0]); request.setAttribute("community", communities[0]);
} }
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp"); JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
break; break;
} }
} }

View File

@@ -59,12 +59,14 @@ import org.dspace.app.webui.util.FileUploadRequest;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.AuthorizeManager;
import org.dspace.content.Bitstream; import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat; import org.dspace.content.BitstreamFormat;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.FormatIdentifier; import org.dspace.content.FormatIdentifier;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
@@ -172,41 +174,46 @@ public class EditCommunitiesServlet extends DSpaceServlet
showControls(context, request, response); showControls(context, request, response);
return; return;
} }
if(AuthorizeManager.isAdmin(context))
{
// set a variable to show all buttons
request.setAttribute("admin_button", new Boolean(true));
}
// Now proceed according to "action" parameter // Now proceed according to "action" parameter
switch (action) switch (action)
{ {
case START_EDIT_COMMUNITY: case START_EDIT_COMMUNITY:
// Display the relevant "edit community" page // Display the relevant "edit community" page
JSPManager.showJSP(request, response, "/dspace-admin/edit-community.jsp"); JSPManager.showJSP(request, response, "/tools/edit-community.jsp");
break; break;
case START_DELETE_COMMUNITY: case START_DELETE_COMMUNITY:
// Show "confirm delete" page // Show "confirm delete" page
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/confirm-delete-community.jsp"); "/tools/confirm-delete-community.jsp");
break; break;
case START_CREATE_COMMUNITY: case START_CREATE_COMMUNITY:
// Display edit community page with empty fields + create button // Display edit community page with empty fields + create button
JSPManager.showJSP(request, response, "/dspace-admin/edit-community.jsp"); JSPManager.showJSP(request, response, "/tools/edit-community.jsp");
break; break;
case START_EDIT_COLLECTION: case START_EDIT_COLLECTION:
// Display the relevant "edit collection" page // Display the relevant "edit collection" page
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp"); JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
break; break;
case START_DELETE_COLLECTION: case START_DELETE_COLLECTION:
// Show "confirm delete" page // Show "confirm delete" page
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/confirm-delete-collection.jsp"); "/tools/confirm-delete-collection.jsp");
break; break;
case START_CREATE_COLLECTION: case START_CREATE_COLLECTION:
// Forward to collection creation wizard // Forward to collection creation wizard
response.sendRedirect(response.encodeRedirectURL( response.sendRedirect(response.encodeRedirectURL(
request.getContextPath() + "/dspace-admin/collection-wizard?community_id=" + request.getContextPath() + "/tools/collection-wizard?community_id=" +
community.getID())); community.getID()));
break; break;
@@ -335,7 +342,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
} }
else else
{ {
community = Community.create(context); community = Community.create(null, context);
} }
// Set attribute // Set attribute
request.setAttribute("community", community); request.setAttribute("community", community);
@@ -388,7 +395,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
community.update(); community.update();
// Show edit page again - attributes set in doDSPost() // Show edit page again - attributes set in doDSPost()
JSPManager.showJSP(request, response, "/dspace-admin/edit-community.jsp"); JSPManager.showJSP(request, response, "/tools/edit-community.jsp");
} }
else if(button.equals("submit_authorization_edit")) else if(button.equals("submit_authorization_edit"))
{ {
@@ -491,7 +498,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
collection.setLogo(null); collection.setLogo(null);
// Show edit page again - attributes set in doDSPost() // Show edit page again - attributes set in doDSPost()
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp"); JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
} }
else if(button.startsWith("submit_wf_create_")) else if(button.startsWith("submit_wf_create_"))
{ {
@@ -575,7 +582,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
g.delete(); g.delete();
// Show edit page again - attributes set in doDSPost() // Show edit page again - attributes set in doDSPost()
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp"); JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
} }
else if(button.equals("submit_create_template")) else if(button.equals("submit_create_template"))
{ {
@@ -584,7 +591,9 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Forward to edit page for new template item // Forward to edit page for new template item
Item i = collection.getTemplateItem(); Item i = collection.getTemplateItem();
i.setOwningCollection(collection);
// have to update to avoid ref. integrity error // have to update to avoid ref. integrity error
i.update();
collection.update(); collection.update();
context.complete(); context.complete();
response.sendRedirect(response.encodeRedirectURL( response.sendRedirect(response.encodeRedirectURL(
@@ -605,7 +614,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
collection.removeTemplateItem(); collection.removeTemplateItem();
// Show edit page again - attributes set in doDSPost() // Show edit page again - attributes set in doDSPost()
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp"); JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
} }
else else
{ {
@@ -675,7 +684,13 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Identify the format // Identify the format
BitstreamFormat bf = FormatIdentifier.guessFormat(context, logoBS); BitstreamFormat bf = FormatIdentifier.guessFormat(context, logoBS);
logoBS.setFormat(bf); logoBS.setFormat(bf);
AuthorizeManager.addPolicy(context, logoBS, Constants.WRITE, context.getCurrentUser());
logoBS.update(); logoBS.update();
if(AuthorizeManager.isAdmin(context))
{
// set a variable to show all buttons
request.setAttribute("admin_button", new Boolean(true));
}
if (collection == null) if (collection == null)
@@ -684,7 +699,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Show community edit page // Show community edit page
request.setAttribute("community", community); request.setAttribute("community", community);
JSPManager.showJSP(request, response, "/dspace-admin/edit-community.jsp"); JSPManager.showJSP(request, response, "/tools/edit-community.jsp");
} }
else else
{ {
@@ -693,7 +708,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
request.setAttribute("collection", collection); request.setAttribute("collection", collection);
request.setAttribute("community", community); request.setAttribute("community", community);
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp"); JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
} }
// Remove temp file // Remove temp file

View File

@@ -95,10 +95,12 @@ public class GroupEditServlet extends DSpaceServlet
// is this user authorized to edit this group? // is this user authorized to edit this group?
AuthorizeManager.authorizeAction(c, group, Constants.ADD); AuthorizeManager.authorizeAction(c, group, Constants.ADD);
String button = UIUtil.getSubmitButton(request, "submit"); boolean submit_edit = (request.getParameter("submit_edit") != null);
boolean submit_group_update = (request.getParameter("submit_group_update") != null);
boolean submit_group_delete = (request.getParameter("submit_group_delete") != null);
// just chosen a group to edit - get group and pass it to group-edit.jsp // just chosen a group to edit - get group and pass it to group-edit.jsp
if( button.equals("submit_edit") ) if( submit_edit && !submit_group_update && !submit_group_delete )
{ {
request.setAttribute("group", group); request.setAttribute("group", group);
request.setAttribute("members", group.getMembers()); request.setAttribute("members", group.getMembers());
@@ -106,7 +108,7 @@ public class GroupEditServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/tools/group-edit.jsp" ); JSPManager.showJSP(request, response, "/tools/group-edit.jsp" );
} }
// update the members of the group // update the members of the group
else if( button.equals("submit_group_update") ) else if( submit_group_update )
{ {
// first off, did we change the group name? // first off, did we change the group name?
String newName = request.getParameter("group_name"); String newName = request.getParameter("group_name");
@@ -179,7 +181,7 @@ public class GroupEditServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/tools/group-edit.jsp" ); JSPManager.showJSP(request, response, "/tools/group-edit.jsp" );
c.complete(); c.complete();
} }
else if( button.equals( "submit_group_delete" ) ) else if( submit_group_delete )
{ {
// bogus authorize, only admins can do this // bogus authorize, only admins can do this
AuthorizeManager.authorizeAction(c, group, Constants.WRITE); AuthorizeManager.authorizeAction(c, group, Constants.WRITE);

View File

@@ -432,8 +432,12 @@ public class Collection extends DSpaceObject
public Bitstream setLogo(InputStream is) public Bitstream setLogo(InputStream is)
throws AuthorizeException, IOException, SQLException throws AuthorizeException, IOException, SQLException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); // authorized to remove the logo when DELETE rights
// authorized when canEdit
if (! (is == null && AuthorizeManager.authorizeActionBoolean(ourContext, this, Constants.DELETE)) ) {
canEdit();
}
// First, delete any existing logo // First, delete any existing logo
if (!collectionRow.isColumnNull("logo_bitstream_id")) if (!collectionRow.isColumnNull("logo_bitstream_id"))
@@ -721,7 +725,7 @@ public class Collection extends DSpaceObject
throws SQLException, AuthorizeException throws SQLException, AuthorizeException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); canEdit();
if (template == null) if (template == null)
{ {
@@ -750,7 +754,7 @@ public class Collection extends DSpaceObject
throws SQLException, AuthorizeException, IOException throws SQLException, AuthorizeException, IOException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); canEdit();
collectionRow.setColumnNull("template_item_id"); collectionRow.setColumnNull("template_item_id");
DatabaseManager.update(ourContext, collectionRow); DatabaseManager.update(ourContext, collectionRow);
@@ -828,6 +832,12 @@ public class Collection extends DSpaceObject
if (!tri.hasNext()) if (!tri.hasNext())
{ {
//make the right to remove the item explicit because the implicit relation
//has been removed. This only has to concern the currentUser because
//he started the removal process and he will end it too.
//also add right to remove from the item to remove it's bundles.
AuthorizeManager.addPolicy(ourContext, item, Constants.DELETE, ourContext.getCurrentUser());
AuthorizeManager.addPolicy(ourContext, item, Constants.REMOVE, ourContext.getCurrentUser());
// Orphan; delete it // Orphan; delete it
item.delete(); item.delete();
} }
@@ -845,7 +855,7 @@ public class Collection extends DSpaceObject
throws SQLException, IOException, AuthorizeException throws SQLException, IOException, AuthorizeException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); canEdit();
HistoryManager.saveHistory(ourContext, HistoryManager.saveHistory(ourContext,
this, this,
@@ -862,6 +872,29 @@ public class Collection extends DSpaceObject
// reindex this collection (could be smarter, to only do when name changes) // reindex this collection (could be smarter, to only do when name changes)
DSIndexer.reIndexContent(ourContext, this); DSIndexer.reIndexContent(ourContext, this);
} }
public boolean canEditBoolean() throws java.sql.SQLException {
try {
canEdit();
return true;
} catch (AuthorizeException e) {
return false;
}
}
public void canEdit() throws AuthorizeException, SQLException {
Community[] parents = getCommunities();
for (int i = 0; i < parents.length; i++) {
if (AuthorizeManager.authorizeActionBoolean(ourContext, parents[i], Constants.WRITE)) {
return;
}
if (AuthorizeManager.authorizeActionBoolean(ourContext, parents[i], Constants.ADD)) {
return;
}
}
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
}
/** /**

View File

@@ -177,11 +177,11 @@ public class Community extends DSpaceObject
* *
* @return the newly created community * @return the newly created community
*/ */
public static Community create(Context context) public static Community create(Community parent, Context context)
throws SQLException, AuthorizeException throws SQLException, AuthorizeException
{ {
// Only administrators can create communities // Only administrators and adders can create communities
if (!AuthorizeManager.isAdmin(context)) if (!(AuthorizeManager.isAdmin(context) || AuthorizeManager.authorizeActionBoolean(context, parent, Constants.ADD)) )
{ {
throw new AuthorizeException( throw new AuthorizeException(
"Only administrators can create communities"); "Only administrators can create communities");
@@ -381,7 +381,11 @@ public class Community extends DSpaceObject
throws AuthorizeException, IOException, SQLException throws AuthorizeException, IOException, SQLException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); // authorized to remove the logo when DELETE rights
// authorized when canEdit
if (! (is == null && AuthorizeManager.authorizeActionBoolean(ourContext, this, Constants.DELETE)) ) {
canEdit();
}
// First, delete any existing logo // First, delete any existing logo
if (logo != null) if (logo != null)
@@ -424,7 +428,7 @@ public class Community extends DSpaceObject
throws SQLException, IOException, AuthorizeException throws SQLException, IOException, AuthorizeException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); canEdit();
HistoryManager.saveHistory(ourContext, HistoryManager.saveHistory(ourContext,
this, this,
@@ -658,7 +662,7 @@ public class Community extends DSpaceObject
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.ADD); AuthorizeManager.authorizeAction(ourContext, this, Constants.ADD);
Community c = create(ourContext); Community c = create(this, ourContext);
addSubcommunity(c); addSubcommunity(c);
return c; return c;
} }
@@ -725,6 +729,12 @@ public class Community extends DSpaceObject
if (!tri.hasNext()) if (!tri.hasNext())
{ {
//make the right to remove the collection explicit because the implicit relation
//has been removed. This only has to concern the currentUser because
//he started the removal process and he will end it too.
//also add right to remove from the collection to remove it's items.
AuthorizeManager.addPolicy(ourContext, c, Constants.DELETE, ourContext.getCurrentUser());
AuthorizeManager.addPolicy(ourContext, c, Constants.REMOVE, ourContext.getCurrentUser());
// Orphan; delete it // Orphan; delete it
c.delete(); c.delete();
} }
@@ -757,7 +767,13 @@ public class Community extends DSpaceObject
if (!tri.hasNext()) if (!tri.hasNext())
{ {
// Orphan; delete it //make the right to remove the sub explicit because the implicit relation
//has been removed. This only has to concern the currentUser because
//he started the removal process and he will end it too.
//also add right to remove from the subcommunity to remove it's children.
AuthorizeManager.addPolicy(ourContext, c, Constants.DELETE, ourContext.getCurrentUser());
AuthorizeManager.addPolicy(ourContext, c, Constants.REMOVE, ourContext.getCurrentUser());
// Orphan; delete it
c.delete(); c.delete();
} }
} }
@@ -771,8 +787,15 @@ public class Community extends DSpaceObject
throws SQLException, AuthorizeException, IOException throws SQLException, AuthorizeException, IOException
{ {
// Check authorisation // Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.DELETE); // FIXME: If this was a subcommunity, it is first removed from it's parent.
// This means the parentCommunity == null
// But since this is also the case for top-level communities, we would
// give everyone rights to remove the top-level communities.
// The same problem occurs in removing the logo
if (! AuthorizeManager.authorizeActionBoolean(ourContext, getParentCommunity(), Constants.REMOVE) ) {
AuthorizeManager.authorizeAction(ourContext, this, Constants.DELETE);
}
// If not a top-level community, have parent remove me; this // If not a top-level community, have parent remove me; this
// will call delete() after removing the linkage // will call delete() after removing the linkage
Community parent = getParentCommunity(); Community parent = getParentCommunity();
@@ -858,15 +881,26 @@ public class Community extends DSpaceObject
* *
* @return boolean true = current user can edit community * @return boolean true = current user can edit community
*/ */
public boolean canEdit() public boolean canEditBoolean() throws java.sql.SQLException {
throws java.sql.SQLException try {
{ canEdit();
// can this person write to the community? return true;
if( AuthorizeManager.authorizeActionBoolean(ourContext, this, Constants.WRITE) ) } catch (AuthorizeException e) {
{ return false;
return true; }
} }
return false; public void canEdit() throws AuthorizeException, SQLException {
Community[] parents = getAllParents();
for (int i = 0; i < parents.length; i++) {
if (AuthorizeManager.authorizeActionBoolean(ourContext, parents[i], Constants.WRITE)) {
return;
}
if (AuthorizeManager.authorizeActionBoolean(ourContext, parents[i], Constants.ADD)) {
return;
}
}
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
} }
} }

View File

@@ -986,6 +986,12 @@ public class Item extends DSpaceObject
if (!tri.hasNext()) if (!tri.hasNext())
{ {
//make the right to remove the bundle explicit because the implicit relation
//has been removed. This only has to concern the currentUser because
//he started the removal process and he will end it too.
//also add right to remove from the bundle to remove it's bitstreams.
AuthorizeManager.addPolicy(ourContext, b, Constants.DELETE, ourContext.getCurrentUser());
AuthorizeManager.addPolicy(ourContext, b, Constants.REMOVE, ourContext.getCurrentUser());
// The bundle is an orphan, delete it // The bundle is an orphan, delete it
b.delete(); b.delete();
} }
@@ -1157,7 +1163,7 @@ public class Item extends DSpaceObject
// Check authorisation // Check authorisation
// only do write authorization if user is not an editor // only do write authorization if user is not an editor
if( !AuthorizeManager.authorizeActionBoolean(ourContext, getOwningCollection(), Constants.COLLECTION_ADMIN) ) if( !canEdit() )
{ {
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE); AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
} }
@@ -1724,6 +1730,12 @@ public class Item extends DSpaceObject
return true; return true;
} }
// is this person an COLLECTION_EDITOR for the owning collection?
if( getOwningCollection().canEditBoolean())
{
return true;
}
// is this person an COLLECTION_EDITOR for the owning collection? // is this person an COLLECTION_EDITOR for the owning collection?
if( AuthorizeManager.authorizeActionBoolean(ourContext, getOwningCollection(), if( AuthorizeManager.authorizeActionBoolean(ourContext, getOwningCollection(),
Constants.COLLECTION_ADMIN)) Constants.COLLECTION_ADMIN))