On 5/16/2011 1:54 PM, Jason Fowler wrote:
We are using DSpace 1.6.2 with XMLUI and embargoes enabled. We have a setter in place that Richard Rogers developed, and it has worked great. The embargo system blocks access to a bitstream until the appropriate date.

We would like, however, to have a specific notification along the lines of "This item is embargoed until July 21, 2012" when a person clicks on an embargoed bitstream.

Has anyone come up with a way to do that?

I have removed the download link and replaced it with "Access Restricted" for the JSPUI. This message shows up for any item that the user does not have permission to view regardless of its embargo state. A further improvement would be to check the embargo date on the item as well and customize the message based on this. I'm not sure about the format of the patch file, but it should give you the idea. I'm new to DSpace so YMMV and I'm not sure if there's a better best practice here, but I couldn't find one. I hope this helps someone even if you can't use it because of our different choice in interface.

Regards,
Alex Lemann
diff --git 
a/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java
 
b/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java
index 8cd3fea..4f65df4 100644
--- 
a/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java
+++ 
b/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java
@@ -43,6 +43,8 @@ import org.dspace.core.I18nUtil;
 import org.dspace.core.PluginManager;
 import org.dspace.core.Utils;
 
+import org.dspace.authorize.AuthorizeManager;
+
 /**
  * <P>
  * JSP tag for displaying an item.
@@ -889,9 +891,15 @@ public class ItemTag extends TagSupport
 
                                                out
                                     .print("<tr><td headers=\"t1\" 
class=\"standard\">");
-                                out.print(bsLink);
-                                               
out.print(bitstreams[k].getName());
-                                out.print("</a>");
+
+                               if 
(AuthorizeManager.authorizeActionBoolean(UIUtil.obtainContext(request), 
bitstreams[k], Constants.READ)) {
+                                  out.print(bsLink);
+                                 out.print(bitstreams[k].getName());
+                                  out.print("</a>");
+                               }
+                               else {
+                                 out.print(bitstreams[k].getName());
+                               }
                                 
 
                                                if (multiFile)
@@ -937,6 +945,8 @@ public class ItemTag extends TagSupport
                                                        }
                                                }
 
+                 if 
(AuthorizeManager.authorizeActionBoolean(UIUtil.obtainContext(request), 
bitstreams[k], Constants.READ)) {
+
                                                out
                                     .print(bsLink
                                             + LocaleSupport
@@ -944,6 +954,13 @@ public class ItemTag extends TagSupport
                                                             pageContext,
                                                             
"org.dspace.app.webui.jsptag.ItemTag.view")
                                             + "</a></td></tr>");
+                }
+                else {
+                  out.print("Access Restricted</td></tr>");
+                }
+
+
+
                                        }
                                }
                        }
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to