@Override public void delete(Context context, Site dso) throws SQLException, AuthorizeException, IOException { throw new AuthorizeException("Site object cannot be deleted"); }
@Override public List<String> generateOutput(RecordSet recordSet) { log.info("BTE OutputGenerator started. Records to output: " + recordSet.getRecords().size()); // Printing debug message String totalString = ""; for (Record record : recordSet.getRecords()) { totalString += SubmissionLookupUtils.getPrintableString(record) + "\n"; } log.debug("Records to output:\n" + totalString); witems = new ArrayList<WorkspaceItem>(); for (Record rec : recordSet.getRecords()) { try { WorkspaceItem wi = workspaceItemService.create(context, collection, true); merge(formName, wi.getItem(), rec); witems.add(wi); } catch (AuthorizeException e) { log.error(e.getMessage(), e); } catch (SQLException e) { log.error(e.getMessage(), e); } } return new ArrayList<String>(); }
} catch (AuthorizeException authE) { System.out.println("Error - Authorize exception: " + authE.toString()); } catch (IOException ioE) { System.out.println("Error - IO exception: " + ioE.toString());
public void addBody(Body body) throws SAXException, WingException, SQLException, IOException, AuthorizeException { if(!authorized) throw new AuthorizeException("You are not authorized to perform this task"); xmluiActionUI.addBody(body); }
return 1; } catch (AuthorizeException ex) { System.err.println(ex.getMessage()); return 1; } catch (IOException ex) {
/** * Throw an AuthorizeException if the current user is not a System Admin * * @param context the DSpace Context Object * @throws AuthorizeException if authorization error * if the current user is not a System Admin * @throws SQLException if database error * if a db error occur */ public static void requireAdminRole(Context context) throws AuthorizeException, SQLException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only system admin are allowed to perform this action"); } }
id.id.toString() + " couldn't be converted: " + "anonymous user doesn't have read permsission. " + ex.getMessage()); toDelete.add(id); } catch (IllegalArgumentException ex) {
@Override public void delete(Context context, MetadataSchema metadataSchema) throws SQLException, AuthorizeException { // Check authorisation: Only admins may create DC types if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators may modify the metadata registry"); } log.info(LogManager.getHeader(context, "delete_metadata_schema", "metadata_schema_id=" + metadataSchema.getID())); metadataSchemaDAO.delete(context, metadataSchema); }
System.exit(1); } catch (AuthorizeException ex) { System.err.format("Not authorized: %s%n", ex.getMessage()); System.exit(1);
@Override public void update(Context context, List<BitstreamFormat> bitstreamFormats) throws SQLException, AuthorizeException { if (CollectionUtils.isNotEmpty(bitstreamFormats)) { // Check authorisation - only administrators can change formats if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can modify bitstream formats"); } for (BitstreamFormat bitstreamFormat : bitstreamFormats) { log.info(LogManager.getHeader(context, "update_bitstream_format", "bitstream_format_id=" + bitstreamFormat.getID())); bitstreamFormatDAO.save(context, bitstreamFormat); } } }
metadataField = metadataFieldService.create(context, epersonSchema, metadataName, null, null); } catch (AuthorizeException e) { log.error(e.getMessage(), e); return false; } catch (NonUniqueMetadataException e) {
protected void doDSPost(Context c, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { // check to see if the statistics are restricted to administrators boolean publicise = ConfigurationManager.getBooleanProperty("report.public"); // determine the navigation bar to be displayed String navbar = (!publicise ? "admin" : "default"); request.setAttribute("navbar", navbar); // is the user a member of the Administrator (1) group boolean admin = Group.isMember(c, 1); if (publicise || admin) { showStatistics(c, request, response); } else { throw new AuthorizeException(); } }
processException(e.getMessage(), context); } catch (AuthorizeException e) { processException(e.getMessage(), context); } catch (ContextException e) { processException("Unauthorized filtered item query. " + e.getMessage(), context);
throw new AuthorizeException( "You are not authorized to download this Export Archive.");
processException("Context error:" + e.getMessage(), context); } catch (AuthorizeException e) { processException("Authorize error:" + e.getMessage(), context); } catch (IOException e) { processException("IO error:" + e.getMessage(), context);
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { // is the statistics data publically viewable? boolean privatereport = ConfigurationManager.getBooleanProperty("solr-statistics", "authorization.admin"); // is the user a member of the Administrator (1) group? boolean admin = Group.isMember(context, 1); if (!privatereport || admin) { displayStatistics(context, request, response); } else { throw new AuthorizeException(); } }
log.error(e.getMessage(), e); } catch (AuthorizeException e) { log.error(e.getMessage(), e);
@Override public BitstreamFormat create(Context context) throws SQLException, AuthorizeException { // Check authorisation - only administrators can create new formats if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can create bitstream formats"); } // Create a table row BitstreamFormat bitstreamFormat = bitstreamFormatDAO.create(context, new BitstreamFormat()); log.info(LogManager.getHeader(context, "create_bitstream_format", "bitstream_format_id=" + bitstreamFormat.getID())); return bitstreamFormat; }
} catch (AuthorizeException e) { log.error("User not authroized to create bundle on item \"" + item.getName() + "\": " + e.getMessage()); } catch (AuthorizeException e) { log.error("User not authroized to create bundle on item \"" + item.getName() + "\": " + e.getMessage());