2009/2/11 Reuben Pasquini <[email protected]>
>
> Hi Sean,
>
> We have a simple embargo setup working on a repository with
> a single collection and a simple embargo model.
I fear we have very different definitions of 'simple'!
> I can give you a dspace-1.5.1ish-api.jar that implements this
> if you like.
How would I use that?
I managed to follow your steps as far as applying your patch to
AuthorizeManager.java.
I'm not sure that I've managed to reconstruct the patch file with the
line-breaks in the correct places, so I've attached it. Would you mind
taking a look?
I get the following error:
dsp...@seanc:~/dspace-1_5_1/dspace-api$ patch -p0 --dry-run <../../AuthMgr.patch
patching file src/main/java/org/dspace/authorize/AuthorizeManager.java
Hunk #2 FAILED at 78.
Hunk #3 FAILED at 245.
Hunk #4 FAILED at 278.
Hunk #5 FAILED at 306.
4 out of 5 hunks FAILED -- saving rejects to file
src/main/java/org/dspace/authorize/AuthorizeManager.java.rej
> Good luck!
I'm not sure that'll be enough!
Sean
--
Sean Carte
esAL Library Systems Manager
+27 72 898 8775
+27 31 373 2490
fax: 0866741254
http://esal.dut.ac.za/
Index: src/main/java/org/dspace/authorize/AuthorizeManager.java
===================================================================
---
src/main/java/org/dspace/authorize/AuthorizeManager.java (revision 2942)
+++ src/main/java/org/dspace/authorize/AuthorizeManager.java (working copy)
@@ -40,11 +40,19 @@
package org.dspace.authorize;
import java.sql.SQLException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import org.apache.log4j.Logger;
+import org.dspace.content.Bitstream;
+import org.dspace.content.Bundle;
+import org.dspace.content.DCValue;
import org.dspace.content.DSpaceObject;
+import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
@@ -70,6 +78,7 @@
*/
public class AuthorizeManager
{
+ private static final Logger log = Logger.getLogger(AuthorizeManager.class);
/**
* Utility method, checks that the current user of the given context can
* perform all of the specified actions on the given object. An
@@ -236,6 +245,9 @@
return isAuthorized;
}
+
+ private static final EmbargoManager mgr_embargo = new SimpleEmbargoManager ();
+
/**
* Check to see if the given user can perform the given action on the given
* object. Always returns true if the ignore authorization flat is set in
@@ -266,6 +278,11 @@
return false;
}
+
+ //if (log.isDebugEnabled()) {
+ log.info( "authorizing access to object id: " + o.getID () );
+ //}
+
// is authorization disabled for this context?
if (c.ignoreAuthorization())
{
@@ -289,6 +306,18 @@
}
}
+ if ( (Constants.READ == action)
+ && (Constants.BITSTREAM == o.getType ())
+ && mgr_embargo.checkEmbargo( (Bitstream) o, userid )
+ ) {
+ if ( 0 == userid ) {
+ return false;
+ }
+ // a user with WRITE permission on the object does
+ // not need to respect the EMBARGO
+ return authorize( c, o, Constants.WRITE, e );
+ }
+
for (ResourcePolicy rp : getPoliciesActionFilter(c, o, action))
{
// check policies for date validity
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech