public boolean testItem(Context context, Item item) { try { return !authorizeService .authorizeActionBoolean(getAnonContext(), item, org.dspace.core.Constants.READ); } catch (SQLException e) { ItemFilterDefsPerm.log.warn("SQL Exception testing item metadata access " + e.getMessage(), e); return false; } } },;
private boolean isPublic(Item item) { boolean pub = false; try { // Check if READ access allowed on this Item pub = authorizeService.authorizeActionBoolean(context, item, Constants.READ); } catch (SQLException ex) { log.error(ex.getMessage()); } return pub; }
private boolean isAccessible(Context context, Bitstream bitstream) throws DSpaceSwordException { try { return authorizeService .authorizeActionBoolean(context, bitstream, Constants.READ); } catch (SQLException e) { throw new DSpaceSwordException(e); } }
private boolean isAccessible(Context context, Item item) throws DSpaceSwordException { try { return authorizeService .authorizeActionBoolean(context, item, Constants.READ); } catch (SQLException e) { throw new DSpaceSwordException(e); } }
@Override public void canEdit(Context context, Community community) throws AuthorizeException, SQLException { List<Community> parents = getAllParents(context, community); for (Community parent : parents) { if (authorizeService.authorizeActionBoolean(context, parent, Constants.WRITE)) { return; } if (authorizeService.authorizeActionBoolean(context, parent, Constants.ADD)) { return; } } authorizeService.authorizeAction(context, community, Constants.WRITE); }
@Override public void canEdit(Context context, Collection collection, boolean useInheritance) throws SQLException, AuthorizeException { List<Community> parents = communityService.getAllParents(context, collection); for (Community parent : parents) { if (authorizeService.authorizeActionBoolean(context, parent, Constants.WRITE, useInheritance)) { return; } if (authorizeService.authorizeActionBoolean(context, parent, Constants.ADD, useInheritance)) { return; } } authorizeService.authorizeAction(context, collection, Constants.WRITE, useInheritance); }
@Override public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException { List<Collection> myResults = new ArrayList<>(); List<Collection> myCollections; if (community != null) { myCollections = community.getCollections(); } else { myCollections = findAll(context); } // now build a list of collections you have authorization for for (Collection myCollection : myCollections) { if (authorizeService.authorizeActionBoolean(context, myCollection, actionID)) { myResults.add(myCollection); } } return myResults; }
@Override public boolean isItemListedForUser(Context context, Item item) { try { if (authorizeService.isAdmin(context)) { return true; } if (authorizeService.authorizeActionBoolean(context, item, org.dspace.core.Constants.READ)) { if (item.isDiscoverable()) { return true; } } log.debug("item(" + item.getID() + ") " + item.getName() + " is unlisted."); return false; } catch (SQLException e) { log.error(e.getMessage()); return false; } }
public boolean testItem(Context context, Item item) { try { for (Bundle bundle : item.getBundles()) { if (!bundle.getName().equals(BundleName.ORIGINAL.name())) { continue; } for (Bitstream bit : bundle.getBitstreams()) { if (!authorizeService .authorizeActionBoolean(getAnonContext(), bit, org.dspace.core.Constants.READ)) { return true; } } } } catch (SQLException e) { ItemFilterDefsPerm.log.warn("SQL Exception testing original bitstream access " + e.getMessage(), e); } return false; } },
@Override public boolean isShown(DSpaceItem item) { boolean pub = false; try { // If Handle or Item are not found, return false String handle = DSpaceItem.parseHandle(item.getIdentifier()); if (handle == null) { return false; } Item dspaceItem = (Item) handleService.resolveToObject(context, handle); if (dspaceItem == null) { return false; } // Check if READ access allowed on Item pub = authorizeService.authorizeActionBoolean(context, dspaceItem, Constants.READ); } catch (SQLException ex) { log.error(ex.getMessage(), ex); } return pub; }
public boolean testItem(Context context, Item item) { try { for (Bundle bundle : item.getBundles()) { if (!bundle.getName().equals(BundleName.THUMBNAIL.name())) { continue; } for (Bitstream bit : bundle.getBitstreams()) { if (!authorizeService .authorizeActionBoolean(getAnonContext(), bit, org.dspace.core.Constants.READ)) { return true; } } } } catch (SQLException e) { ItemFilterDefsPerm.log .warn("SQL Exception testing thumbnail bitstream access " + e.getMessage(), e); } return false; } },
org.dspace.content.Item item = childItems.next(); log.debug(item.getHandle() + " evaluate."); if (authorizeService.authorizeActionBoolean(context, item, org.dspace.core.Constants.READ)) { Item restItem = new Item(item, servletContext, expand, context); if (save) {
boolean authorized = false; if (AuthorizeConfiguration.canCollectionAdminPerformItemWithdrawn()) { authorized = authorizeService.authorizeActionBoolean(context, item .getOwningCollection(), Constants.ADMIN); } else if (AuthorizeConfiguration.canCommunityAdminPerformItemWithdrawn()) { authorized = authorizeService .authorizeActionBoolean(context, item.getOwningCollection() .getCommunities().get(0), Constants.ADMIN); authorized = authorizeService.authorizeActionBoolean(context, item .getOwningCollection(), Constants.REMOVE, false);
/** * Find out whether bitstream is readable by the public. * * @param bitstream the target bitstream * @return whether bitstream is readable by the Anonymous group */ protected boolean isPublic(Bitstream bitstream) { if (bitstream == null) { return false; } boolean result = false; Context context = null; try { context = new Context(); result = AuthorizeServiceFactory.getInstance().getAuthorizeService() .authorizeActionBoolean(context, bitstream, Constants.READ, true); } catch (SQLException e) { log.error( "Cannot determine whether bitstream is public, assuming it isn't. bitstream_id=" + bitstream.getID(), e); } return result; }
parent.setCommunities(parentComms); for (Community comm : communities) { if (!authorizeService.authorizeActionBoolean(context, comm, org.dspace.core.Constants.READ)) { continue; mycomm.setCollections(myColls); for (Collection coll : colls) { if (!authorizeService.authorizeActionBoolean(context, coll, org.dspace.core.Constants.READ)) { continue;
@Override public boolean canEdit(Context context, Item item) throws SQLException { // can this person write to the item? if (authorizeService.authorizeActionBoolean(context, item, Constants.WRITE)) { return true; } // is this collection not yet created, and an item template is created if (item.getOwningCollection() == null) { if (!isInProgressSubmission(context, item)) { return true; } else { return false; } } return collectionService.canEditBoolean(context, item.getOwningCollection(), false); }
if (AuthorizeConfiguration .canCommunityAdminPerformItemReinstatiate() && authorizeService.authorizeActionBoolean(context, coll.getCommunities().get(0), Constants.ADMIN)) {
if (!authorizeService.authorizeActionBoolean(context, getParentObject(context, community), Constants.REMOVE)) { authorizeService.authorizeAction(context, community, Constants.DELETE);
if (!((is == null) && authorizeService.authorizeActionBoolean( context, community, Constants.DELETE))) { canEdit(context, community);
if (!((is == null) && authorizeService.authorizeActionBoolean( context, collection, Constants.DELETE))) { canEdit(context, collection, true);