Skip to content

Commit

Permalink
Allow use of request copy following the dspace.cfg configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Bollini committed Oct 21, 2013
1 parent e4fb7cc commit 4176e6a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
Expand Up @@ -901,6 +901,15 @@ private void listBitstreams() throws IOException
}
else
{
Context context = UIUtil
.obtainContext(request);
boolean showRequestCopy = false;
if ("all".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) ||
("logged".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) &&
context.getCurrentUser() != null))
{
showRequestCopy = true;
}
for (int i = 0; i < bundles.length; i++)
{
Bitstream[] bitstreams = bundles[i].getBitstreams();
Expand Down Expand Up @@ -997,9 +1006,8 @@ private void listBitstreams() throws IOException
+ "</a>");

try {
if (!AuthorizeManager
.authorizeActionBoolean(UIUtil
.obtainContext(request),
if (showRequestCopy && !AuthorizeManager
.authorizeActionBoolean(context,
bitstreams[k],
Constants.READ))
out.print("&nbsp;<a class=\"btn btn-success\" href=\""
Expand Down
Expand Up @@ -72,7 +72,7 @@ protected void doDSGet(Context context,
HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
{
// First get the step
// First get the step
int step = UIUtil.getIntParameter(request, "step");

try
Expand Down Expand Up @@ -123,7 +123,20 @@ private void processForm (Context context,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
{
{
boolean showRequestCopy = false;
if ("all".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) ||
("logged".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) &&
context.getCurrentUser() != null))
{
showRequestCopy = true;
}

if (!showRequestCopy)
{
throw new AuthorizeException("The request copy feature is disabled");
}

// handle
String handle = request.getParameter("handle");

Expand Down

0 comments on commit 4176e6a

Please sign in to comment.