mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 22:43:12 +00:00
Fix for SF bug [1730606] Restricted Items metadata exposed via OAI
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3346 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -389,6 +389,7 @@ public class Subscribe
|
||||
Collection c = (Collection) collections.get(i);
|
||||
|
||||
try {
|
||||
boolean includeAll = ConfigurationManager.getBooleanProperty("harvest.includerestricted.subscription", true);
|
||||
List itemInfos = Harvest.harvest(context, c, startDate, endDate, 0, // Limit
|
||||
// and
|
||||
// offset
|
||||
@@ -397,7 +398,8 @@ public class Subscribe
|
||||
// everything
|
||||
0, true, // Need item objects
|
||||
false, // But not containers
|
||||
false); // Or withdrawals
|
||||
false, // Or withdrawals
|
||||
includeAll);
|
||||
|
||||
if (ConfigurationManager.getBooleanProperty("eperson.subscription.onlynew", false))
|
||||
{
|
||||
|
@@ -60,6 +60,8 @@ import org.dspace.handle.HandleManager;
|
||||
import org.dspace.storage.rdbms.DatabaseManager;
|
||||
import org.dspace.storage.rdbms.TableRow;
|
||||
import org.dspace.storage.rdbms.TableRowIterator;
|
||||
import org.dspace.authorize.AuthorizeManager;
|
||||
import org.dspace.eperson.Group;
|
||||
|
||||
/**
|
||||
* Utility class for extracting information about items, possibly just within a
|
||||
@@ -111,14 +113,16 @@ public class Harvest
|
||||
* @param withdrawn
|
||||
* If <code>true</code>, information about withdrawn items is
|
||||
* included
|
||||
* @param nonAnon
|
||||
* If items without anonymous access should be included or not
|
||||
* @return List of <code>HarvestedItemInfo</code> objects
|
||||
* @throws SQLException
|
||||
* @throws ParseException If the date is not in a supported format
|
||||
*/
|
||||
public static List harvest(Context context, DSpaceObject scope,
|
||||
String startDate, String endDate, int offset, int limit,
|
||||
boolean items, boolean collections, boolean withdrawn)
|
||||
throws SQLException, ParseException
|
||||
boolean items, boolean collections, boolean withdrawn,
|
||||
boolean nonAnon) throws SQLException, ParseException
|
||||
{
|
||||
|
||||
// Put together our query. Note there is no need for an
|
||||
@@ -261,7 +265,22 @@ public class Harvest
|
||||
itemInfo.item = Item.find(context, itemInfo.itemID);
|
||||
}
|
||||
|
||||
infoObjects.add(itemInfo);
|
||||
if (nonAnon)
|
||||
{
|
||||
infoObjects.add(itemInfo);
|
||||
} else
|
||||
{
|
||||
Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, itemInfo.item, Constants.READ);
|
||||
boolean added = false;
|
||||
for (int i = 0; i < authorizedGroups.length; i++)
|
||||
{
|
||||
if ((authorizedGroups[i].getID() == 0) && (!added))
|
||||
{
|
||||
infoObjects.add(itemInfo);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
|
Reference in New Issue
Block a user