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,
available from:
@@ -7,9 +7,13 @@ http://sourceforge.net/projects/dspace/
Documentation may be viewed online at dspace.org, but these pertain to the
most recent stable release; the installation instructions for this beta
may be different so you are encouraged to download the dspace-docs
package corresponding to this beta from the above SourceForge page and refer
any problems to the dspace-tech@lists.sourceforge.net mailing list.
may be different so you are encouraged to obtain the docs from cvs, or to
download the latest documentation snapshot from
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

View File

@@ -35,6 +35,10 @@ config.template.oaicat.properties = /dspace/config/oaicat.properties
##### Database settings #####
# Database name ("oracle", or "postgres")
db.name = postgres
#db.name = oracle
# URL for connecting to database
db.url = jdbc:postgresql://localhost:5432/dspace
@@ -129,6 +133,21 @@ webui.cert.autoregister = true
# Should the submit UI block submissions marked as theses?
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 #####

View File

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

View File

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

View File

@@ -72,8 +72,12 @@
request.getAttribute("last.submitted.titles");
String[] lastSubmittedURLs = (String[])
request.getAttribute("last.submitted.urls");
Boolean admin_b = (Boolean)request.getAttribute("admin_button");
boolean admin_button = (admin_b == null ? false : admin_b.booleanValue());
Boolean editor_b = (Boolean)request.getAttribute("editor_button");
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
@@ -172,8 +176,25 @@
{
%>
<LI>
<table>
<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>
</LI>
<%
@@ -196,8 +217,24 @@
{
%>
<LI>
<table>
<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>
</LI>
<%
@@ -211,7 +248,7 @@
<P class="copyrightText"><%= copyright %></P>
<dspace:sidebar>
<% if(admin_button) // admin edit button
<% if(editor_button || add_button) // edit button(s)
{ %>
<table class=miscTable align=center>
<tr>
@@ -224,20 +261,24 @@
</tr>
<tr>
<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="action" value="<%=EditCommunitiesServlet.START_EDIT_COMMUNITY%>">
<input type="submit" value="Edit...">
</form>
<form method=POST action="<%=request.getContextPath()%>/dspace-admin/collection-wizard">
<% } %>
<% if(add_button) { %>
<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 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="parent_community_id" value="<%= community.getID() %>">
<input type="submit" name="submit" value="Create Sub-community">
</form>
<% } %>
</td>
</tr>
<tr>

View File

@@ -67,7 +67,7 @@
</tr>
</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>
<tr>
<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>
<form method=POST action="<%= request.getContextPath() %>/dspace-admin/collection-wizard">
<form method=POST action="<%= request.getContextPath() %>/tools/collection-wizard">
<center><table class="miscTable">
<tr>
<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>
<form action="<%= request.getContextPath() %>/dspace-admin/collection-wizard" method=post>
<form action="<%= request.getContextPath() %>/tools/collection-wizard" method=post>
<center>
<table>

View File

@@ -58,7 +58,7 @@
<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.
<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();
labels.add("Communities/<br>Collections");
links.add("/dspace-admin/edit-communities");
links.add("/tools/edit-communities");
labels.add("E-people");
links.add("/dspace-admin/edit-epeople");

View File

@@ -58,7 +58,7 @@
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>

View File

@@ -56,7 +56,7 @@
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>

View File

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

View File

@@ -58,6 +58,8 @@
<%
Community community = (Community) request.getAttribute("community");
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 shortDesc = "";
@@ -105,6 +107,7 @@
{
%>
<H1>Edit Community <%= community.getHandle() %></H1>
<% if(admin_button ) { %>
<center>
<table width="70%">
<tr>
@@ -118,6 +121,7 @@
</tr>
</table>
</center>
<% } %>
<%
}
%>
@@ -184,6 +188,7 @@
<% } %>
</td>
</tr>
<% if(admin_button ) { %>
<%-- ===========================================================
Edit community's policies
=========================================================== --%>
@@ -193,6 +198,7 @@
<input type="submit" name="submit_authorization_edit" value="Edit...">
</td>
</tr>
<% } %>
</table>

View File

@@ -349,11 +349,25 @@ public class HandleServlet extends DSpaceServlet
String[] itemLinks = getItemURLs(context, items);
// can they admin this collection?
if(AuthorizeManager.authorizeActionBoolean(context, community, Constants.WRITE))
// is the user a COMMUNITY_EDITOR?
if(community.canEditBoolean())
{
// 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
@@ -438,17 +452,17 @@ public class HandleServlet extends DSpaceServlet
{
subscribed = Subscribe.isSubscribed(context, e, collection);
// can they admin this collection?
if(AuthorizeManager.authorizeActionBoolean(context, collection, Constants.WRITE))
// is the user a COLLECTION_EDITOR?
if(collection.canEditBoolean())
{
// 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))
{
request.setAttribute("editor_button", new Boolean(true));
request.setAttribute("admin_button", new Boolean(true));
// give them a button to manage submitter list
// what group is the submitter?

View File

@@ -641,7 +641,7 @@ public class CollectionWizardServlet extends DSpaceServlet
Community[] communities = collection.getCommunities();
request.setAttribute("community", communities[0]);
}
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp");
JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
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.UIUtil;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.AuthorizeManager;
import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.FormatIdentifier;
import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.eperson.Group;
@@ -172,41 +174,46 @@ public class EditCommunitiesServlet extends DSpaceServlet
showControls(context, request, response);
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
switch (action)
{
case START_EDIT_COMMUNITY:
// Display the relevant "edit community" page
JSPManager.showJSP(request, response, "/dspace-admin/edit-community.jsp");
JSPManager.showJSP(request, response, "/tools/edit-community.jsp");
break;
case START_DELETE_COMMUNITY:
// Show "confirm delete" page
JSPManager.showJSP(request, response,
"/dspace-admin/confirm-delete-community.jsp");
"/tools/confirm-delete-community.jsp");
break;
case START_CREATE_COMMUNITY:
// 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;
case START_EDIT_COLLECTION:
// Display the relevant "edit collection" page
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp");
JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
break;
case START_DELETE_COLLECTION:
// Show "confirm delete" page
JSPManager.showJSP(request, response,
"/dspace-admin/confirm-delete-collection.jsp");
"/tools/confirm-delete-collection.jsp");
break;
case START_CREATE_COLLECTION:
// Forward to collection creation wizard
response.sendRedirect(response.encodeRedirectURL(
request.getContextPath() + "/dspace-admin/collection-wizard?community_id=" +
request.getContextPath() + "/tools/collection-wizard?community_id=" +
community.getID()));
break;
@@ -335,7 +342,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
}
else
{
community = Community.create(context);
community = Community.create(null, context);
}
// Set attribute
request.setAttribute("community", community);
@@ -388,7 +395,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
community.update();
// 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"))
{
@@ -491,7 +498,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
collection.setLogo(null);
// 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_"))
{
@@ -575,7 +582,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
g.delete();
// 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"))
{
@@ -584,7 +591,9 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Forward to edit page for new template item
Item i = collection.getTemplateItem();
i.setOwningCollection(collection);
// have to update to avoid ref. integrity error
i.update();
collection.update();
context.complete();
response.sendRedirect(response.encodeRedirectURL(
@@ -605,7 +614,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
collection.removeTemplateItem();
// 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
{
@@ -675,7 +684,13 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Identify the format
BitstreamFormat bf = FormatIdentifier.guessFormat(context, logoBS);
logoBS.setFormat(bf);
AuthorizeManager.addPolicy(context, logoBS, Constants.WRITE, context.getCurrentUser());
logoBS.update();
if(AuthorizeManager.isAdmin(context))
{
// set a variable to show all buttons
request.setAttribute("admin_button", new Boolean(true));
}
if (collection == null)
@@ -684,7 +699,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Show community edit page
request.setAttribute("community", community);
JSPManager.showJSP(request, response, "/dspace-admin/edit-community.jsp");
JSPManager.showJSP(request, response, "/tools/edit-community.jsp");
}
else
{
@@ -693,7 +708,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
request.setAttribute("collection", collection);
request.setAttribute("community", community);
JSPManager.showJSP(request, response, "/dspace-admin/edit-collection.jsp");
JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");
}
// Remove temp file

View File

@@ -95,10 +95,12 @@ public class GroupEditServlet extends DSpaceServlet
// is this user authorized to edit this group?
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
if( button.equals("submit_edit") )
if( submit_edit && !submit_group_update && !submit_group_delete )
{
request.setAttribute("group", group);
request.setAttribute("members", group.getMembers());
@@ -106,7 +108,7 @@ public class GroupEditServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/tools/group-edit.jsp" );
}
// 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?
String newName = request.getParameter("group_name");
@@ -179,7 +181,7 @@ public class GroupEditServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/tools/group-edit.jsp" );
c.complete();
}
else if( button.equals( "submit_group_delete" ) )
else if( submit_group_delete )
{
// bogus authorize, only admins can do this
AuthorizeManager.authorizeAction(c, group, Constants.WRITE);

View File

@@ -433,7 +433,11 @@ public class Collection extends DSpaceObject
throws AuthorizeException, IOException, SQLException
{
// 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
if (!collectionRow.isColumnNull("logo_bitstream_id"))
@@ -721,7 +725,7 @@ public class Collection extends DSpaceObject
throws SQLException, AuthorizeException
{
// Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
canEdit();
if (template == null)
{
@@ -750,7 +754,7 @@ public class Collection extends DSpaceObject
throws SQLException, AuthorizeException, IOException
{
// Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
canEdit();
collectionRow.setColumnNull("template_item_id");
DatabaseManager.update(ourContext, collectionRow);
@@ -828,6 +832,12 @@ public class Collection extends DSpaceObject
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
item.delete();
}
@@ -845,7 +855,7 @@ public class Collection extends DSpaceObject
throws SQLException, IOException, AuthorizeException
{
// Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
canEdit();
HistoryManager.saveHistory(ourContext,
this,
@@ -863,6 +873,29 @@ public class Collection extends DSpaceObject
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);
}
/**
* Delete the collection, including the metadata and logo. Items that

View File

@@ -177,11 +177,11 @@ public class Community extends DSpaceObject
*
* @return the newly created community
*/
public static Community create(Context context)
public static Community create(Community parent, Context context)
throws SQLException, AuthorizeException
{
// Only administrators can create communities
if (!AuthorizeManager.isAdmin(context))
// Only administrators and adders can create communities
if (!(AuthorizeManager.isAdmin(context) || AuthorizeManager.authorizeActionBoolean(context, parent, Constants.ADD)) )
{
throw new AuthorizeException(
"Only administrators can create communities");
@@ -381,7 +381,11 @@ public class Community extends DSpaceObject
throws AuthorizeException, IOException, SQLException
{
// 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
if (logo != null)
@@ -424,7 +428,7 @@ public class Community extends DSpaceObject
throws SQLException, IOException, AuthorizeException
{
// Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.WRITE);
canEdit();
HistoryManager.saveHistory(ourContext,
this,
@@ -658,7 +662,7 @@ public class Community extends DSpaceObject
// Check authorisation
AuthorizeManager.authorizeAction(ourContext, this, Constants.ADD);
Community c = create(ourContext);
Community c = create(this, ourContext);
addSubcommunity(c);
return c;
}
@@ -725,6 +729,12 @@ public class Community extends DSpaceObject
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
c.delete();
}
@@ -757,6 +767,12 @@ public class Community extends DSpaceObject
if (!tri.hasNext())
{
//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();
}
@@ -771,7 +787,14 @@ public class Community extends DSpaceObject
throws SQLException, AuthorizeException, IOException
{
// Check authorisation
// 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
// will call delete() after removing the linkage
@@ -858,15 +881,26 @@ public class Community extends DSpaceObject
*
* @return boolean true = current user can edit community
*/
public boolean canEdit()
throws java.sql.SQLException
{
// can this person write to the community?
if( AuthorizeManager.authorizeActionBoolean(ourContext, this, Constants.WRITE) )
{
public boolean canEditBoolean() throws java.sql.SQLException {
try {
canEdit();
return true;
}
} catch (AuthorizeException e) {
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())
{
//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
b.delete();
}
@@ -1157,7 +1163,7 @@ public class Item extends DSpaceObject
// Check authorisation
// 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);
}
@@ -1724,6 +1730,12 @@ public class Item extends DSpaceObject
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?
if( AuthorizeManager.authorizeActionBoolean(ourContext, getOwningCollection(),
Constants.COLLECTION_ADMIN))