@Override public List<Collection> getAvailableSubscriptions(Context context, EPerson eperson) throws SQLException { List<Collection> collections; if (eperson != null) { context.setCurrentUser(eperson); } collections = collectionService.findAuthorized(context, null, Constants.ADD); return collections; }
context.setCurrentUser(authenticatedUser); session.setAttribute(EFFECTIVE_USER_ID, authenticatedID); return; context.setCurrentUser(null); session.removeAttribute(EFFECTIVE_USER_ID); session.removeAttribute(AUTHENTICATED_USER_ID);
context.setCurrentUser(null); request.removeAttribute("is.admin"); request.removeAttribute("dspace.current.user");
context.setCurrentUser(eperson);
context.setCurrentUser(eperson); harvester.runHarvest(); context.complete();
context.setCurrentUser(eperson); context.setCurrentUser(null); return;
/** * Set EPerson doing import * * @param context DSpace Context * @param eperson EPerson obj * @throws Exception if error */ protected void setEPerson(Context context, String eperson) throws Exception { if (eperson == null) { pr("Error - an eperson to do the importing must be specified"); pr(" (run with -h flag for details)"); throw new Exception("EPerson not specified."); } EPerson myEPerson = null; if (eperson.indexOf('@') != -1) { // @ sign, must be an email myEPerson = epersonService.findByEmail(context, eperson); } else { myEPerson = epersonService.find(context, UUID.fromString(eperson)); } if (myEPerson == null) { pr("Error, eperson cannot be found: " + eperson); throw new Exception("Invalid EPerson"); } context.setCurrentUser(myEPerson); }
context.setCurrentUser(myEPerson);
context.setCurrentUser(eperson); context.setCurrentUser(null); return;
context.setCurrentUser(eperson); log.info(eperson .getEmail() + " has been authenticated via shibboleth using password-based sword " +
/** * Adds a thread to the ready stack. Can also be called externally to queue up a collection * for harvesting before it is "due" for another cycle. This allows starting a harvest process * from the UI that still "plays nice" with these thread mechanics instead of making an * asynchronous call to runHarvest(). * * @param context The relevant DSpace Context. * @param harvestedCollection collection to be harvested * @throws IOException A general class of exceptions produced by failed or interrupted I/O operations. * @throws SQLException An exception that provides information on a database access error or other errors. * @throws AuthorizeException Exception indicating the current user of the context does not have permission * to perform a particular action. */ public void addThread(Context context, HarvestedCollection harvestedCollection) throws SQLException, IOException, AuthorizeException { log.debug("****** Entered the addThread method. Active threads: " + harvestThreads.toString()); context.setCurrentUser(harvestAdmin); harvestedCollection.setHarvestStatus(HarvestedCollection.STATUS_QUEUED); harvestedCollectionService.update(context, harvestedCollection); context.dispatchEvents(); HarvestThread ht = new HarvestThread(harvestedCollection.getCollection().getID()); harvestThreads.push(ht); log.debug("****** Queued up a thread. Active threads: " + harvestThreads.toString()); log.info("Thread queued up: " + ht.toString()); }
.getID()); context.setCurrentUser( EPersonServiceFactory.getInstance().getEPersonService().findByEmail(context, authentication.getName()));
private static void checkSelectCollectionForUser(EPerson person) throws SQLException { context.setCurrentUser(person); StopWatch stopWatch = new StopWatch("SelectCollectionStep Optimization (" + person.getEmail() + ")"); System.out.println("User: " + person.getEmail()); stopWatch.start("findAuthorized"); List<Collection> collections = collectionService.findAuthorized(context, null, Constants.ADD); stopWatch.stop(); Long defaultMS = stopWatch.getLastTaskTimeMillis(); stopWatch.start("ListingCollections"); System.out.println("Legacy Find Authorized"); reportCollections(collections); stopWatch.stop(); stopWatch.start("findAuthorizedOptimized"); List<Collection> collectionsOptimized = collectionService.findAuthorizedOptimized(context, Constants.ADD); stopWatch.stop(); Long optimizedMS = stopWatch.getLastTaskTimeMillis(); timeSavedMS += defaultMS - optimizedMS; stopWatch.start("ListingCollectionsWithOptimizedCollections"); System.out.println("Find Authorized Optimized"); reportCollections(collectionsOptimized); stopWatch.stop(); if (collections.size() == collectionsOptimized.size()) { System.out.println("Number of collections matches - Good"); } else { System.out.println("Number of collections doesn't match -- Bad"); brokenPeople.add(person); } System.out.println(stopWatch.prettyPrint()); }
context.setCurrentUser(null);
context.setCurrentUser(eperson);
context.setCurrentUser(null);
context.setCurrentUser(null);
.checkPassword(context, eperson, password)) { context.setCurrentUser(eperson); log.info(LogManager.getHeader(context, "authenticate", "type=PasswordAuthentication")); return SUCCESS;
context.setCurrentUser(eperson); context.turnOffAuthorisationSystem();
context.setCurrentUser(loginAs);