Just checking to see if anyone has any ideas to share?  Basically, I would
like that an error message be shown if a user is not authorized to view a
particular collection. By default, an empty collection page is shown which
gives the impression of an "empty collection"
I am using DSpace version 4.1, jspui version.

Please let me know if you need any additional information.

Regards,
Shazia

---------- Forwarded message ----------
From: Shazia Sathar <ssat...@uic.edu>
Date: Wed, Jul 16, 2014 at 1:20 PM
Subject: Display error msg on Collections page when user is not authorized
to view Items
To: DSpace Tech <dspace-tech@lists.sourceforge.net>


Hello All,

I am working on a request for change in my DSpace installation. The
requirement is that an error message like "Access Denied" be displayed on
the Collections page when a logged-in user tries to access a Collection
that he/she is not authorized to access.
The default behavior is that no Items are displayed and is there a way to
change this and add an error msg?

Here is what I tried:
In *HandleServlet.java*, I modified the code and added:
collectionHome()
{
 ...
if (AuthorizeManager.authorizeActionBoolean(context, community,
                    Constants.DEFAULT_ITEM_READ))
{
                // set a variable to indicate read access and hence display
the community heorarchy
                request.setAttribute("read.access", Boolean.TRUE);
}
 else
                {
                    request.setAttribute("read.access",
                            Boolean.FALSE);
                }

..
}

*collection-home.jsp*
...
Boolean readAccess =(Boolean)request.getAttribute("read.access");
boolean read_access = (readAccess== null ? false :
readAccess.booleanValue());
...
<% if(!read_access) { %>
<p style="color:red; font-size:16"> Access Denied </p>
<% }

In he UI, I have  a Collection C1 with the following policies:
C1:
DEFAULT_ITEM_READ  : Group (COLLECTION_25_DEFAULT_ITEM_READ)
DEFAULT_BITSTREAM_READ: Group (COLLECTION_25_DEFAULT_ITEM_READ)

The only member in group COLLECTION_25_DEFAULT_ITEM_READ is user A.

When I log in as user A, I get the "Access Denied" error message on all
Collections including C1. I'm not sure what I'm missing here? I'm not sure
if I am looking at the right permissions.

Does anyone know of an alternate approach- from the CollectionItemList.java
perhaps?


Regards,
Shazia
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to