@Override public void authorizeAction(Context c, DSpaceObject o, int action, boolean useInheritance) throws AuthorizeException, SQLException { authorizeAction(c, c.getCurrentUser(), o, action, useInheritance); }
@Override public List<Collection> findDirectMapped(Context context, int actionID) throws SQLException { return collectionDAO .findAuthorized(context, context.getCurrentUser(), Arrays.asList(Constants.ADD, Constants.ADMIN)); }
@Override public List<Collection> findGroup2GroupMapped(Context context, int actionID) throws SQLException { return collectionDAO .findAuthorizedByGroup(context, context.getCurrentUser(), Collections.singletonList(actionID)); }
@Override public List<Community> findAuthorized(Context context, List<Integer> actions) throws SQLException { return communityDAO.findAuthorized(context, context.getCurrentUser(), actions); }
private boolean isAuthenticatedUser(final Context context, final EPerson ePerson) { return ObjectUtils.equals(context.getCurrentUser(), ePerson); }
@Override public boolean isAdmin(Context c, DSpaceObject o) throws SQLException { return this.isAdmin(c, c.getCurrentUser(), o); }
@Override public boolean isMember(Context context, Group group) throws SQLException { return isMember(context, context.getCurrentUser(), group); }
@Override public List<Community> findAuthorizedGroupMapped(Context context, List<Integer> actions) throws SQLException { return communityDAO.findAuthorizedByGroup(context, context.getCurrentUser(), actions); }
public void updateLastActiveDate(Context context) { EPerson me = context.getCurrentUser(); if (me != null) { me.setLastActive(new Date()); try { ePersonService.update(context, me); } catch (SQLException ex) { log.error("Could not update last-active stamp", ex); } catch (AuthorizeException ex) { log.error("Could not update last-active stamp", ex); } } }
@Override public void createDownloadableExport(DSpaceObject dso, Context context, boolean migrate) throws Exception { EPerson eperson = context.getCurrentUser(); ArrayList<DSpaceObject> list = new ArrayList<DSpaceObject>(1); list.add(dso); processDownloadableExport(list, context, eperson == null ? null : eperson.getEmail(), migrate); }
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { // A GET displays the edit profile form. We assume the authentication // filter means we have a user. log.info(LogManager.getHeader(context, "view_profile", "")); request.setAttribute("eperson", context.getCurrentUser()); JSPManager.showJSP(request, response, "/register/edit-profile.jsp"); }
public boolean isCommunityAdmin(Context c) throws SQLException { EPerson e = c.getCurrentUser(); if (e != null) { List<ResourcePolicy> policies = resourcePolicyService.find(c, e, groupService.allMemberGroups(c, e), Constants.ADMIN, Constants.COMMUNITY); if (CollectionUtils.isNotEmpty(policies)) { return true; } } return false; }
public boolean isCollectionAdmin(Context c) throws SQLException { EPerson e = c.getCurrentUser(); if (e != null) { List<ResourcePolicy> policies = resourcePolicyService.find(c, e, groupService.allMemberGroups(c, e), Constants.ADMIN, Constants.COLLECTION); if (CollectionUtils.isNotEmpty(policies)) { return true; } } return false; }
private Authentication createAuthenticationToken(final String password, final Context context, final List<SimpleGrantedAuthority> grantedAuthorities) { EPerson ePerson = context.getCurrentUser(); if (ePerson != null && StringUtils.isNotBlank(ePerson.getEmail())) { return new UsernamePasswordAuthenticationToken(ePerson.getEmail(), password, grantedAuthorities); } else { log.info( LogManager.getHeader(context, "failed_login", "No eperson with an non-blank e-mail address found")); throw new BadCredentialsException("Login failed"); } }
@Override public void createDownloadableExport(List<DSpaceObject> dsObjects, Context context, boolean migrate) throws Exception { EPerson eperson = context.getCurrentUser(); processDownloadableExport(dsObjects, context, eperson == null ? null : eperson.getEmail(), migrate); }
@Override public void deleteBatchUpload(Context c, String uploadId) throws Exception { String uploadDir = null; String mapFilePath = null; uploadDir = getImportUploadableDirectory(c.getCurrentUser()) + File.separator + uploadId; mapFilePath = uploadDir + File.separator + "mapfile"; this.deleteItems(c, mapFilePath); FileDeleteStrategy.FORCE.delete(new File(uploadDir)); }
@Override public boolean isAuthorized(Context context, HttpServletRequest request, XmlWorkflowItem wfi) throws SQLException, AuthorizeException, IOException, WorkflowConfigurationException { PoolTask task = null; if (context.getCurrentUser() != null) { task = poolTaskService.findByWorkflowIdAndEPerson(context, wfi, context.getCurrentUser()); } //Check if we have pooled the current task return task != null && task.getWorkflowID().equals(getParent().getStep().getWorkflow().getID()) && task.getStepID().equals(getParent().getStep().getId()) && task.getActionID().equals(getParent().getId()); }
@Override public boolean isAuthorized(Context context, HttpServletRequest request, XmlWorkflowItem wfi) throws SQLException { ClaimedTask task = null; if (context.getCurrentUser() != null) { task = claimedTaskService.findByWorkflowIdAndEPerson(context, wfi, context.getCurrentUser()); } //Check if we have claimed the current task return task != null && task.getWorkflowID().equals(getParent().getStep().getWorkflow().getID()) && task.getStepID().equals(getParent().getStep().getId()) && task.getActionID().equals(getParent().getId()); } }
private void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException { //Add the provenance for the accept String now = DCDate.getCurrent().toString(); // Get user's name + email address String usersName = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService() .getEPersonName(c.getCurrentUser()); String provDescription = getProvenanceStartId() + " Approved for entry into archive by " + usersName + " on " + now + " (GMT) "; // Add to item as a DC field itemService.addMetadata(c, wfi.getItem(), MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provDescription); itemService.update(c, wfi.getItem()); }
private void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException { //Add the provenance for the accept String now = DCDate.getCurrent().toString(); // Get user's name + email address String usersName = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService() .getEPersonName(c.getCurrentUser()); String provDescription = getProvenanceStartId() + " Approved for entry into archive by " + usersName + " on " + now + " (GMT) "; // Add to item as a DC field itemService.addMetadata(c, wfi.getItem(), MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provDescription); itemService.update(c, wfi.getItem()); }