protected boolean validateUserContext() { UserContext userContext = UserContext.getInstanceFromPageContext(pageContext); if (userContext.isImpersonating()) { userContext.restoreSession(); } return userContext.hasRequiredRole(IUserManager.ROLE_EPAVIEWER); }
protected boolean renderHeader() throws ServletException, IOException { if (!isLoggedOn()) { pageContext.setAttribute( "ems.header.logo", BrandManager.DEFAULT_HEADER_LOGO + ".gif", // // BrandingSettings.getInstance().getHeaderLogo() + ".gif", PageContext.REQUEST_SCOPE); pageContext.include("/WEB-INF/jspf/common/templates/page/CappEmptyHeader.jspf"); return true; } pageContext.getResponse().setCharacterEncoding("UTF-8"); UserContext userContext = UserContext.getInstanceFromPageContext(pageContext); Customer customer = userContext.getCurrentCustomer(); pageContext.setAttribute("user", userContext.getCurrentUser()); pageContext.setAttribute("customer", customer); // figure out which header to user pageContext.setAttribute("user", userContext.getCurrentUser()); pageContext.setAttribute("ems.header.logoff", "epalogoff.do", PageContext.REQUEST_SCOPE); pageContext.setAttribute("ems.header.home", "customerSearch.do", PageContext.REQUEST_SCOPE); pageContext.setAttribute( "ems.header.logo", BrandManager.DEFAULT_HEADER_LOGO + "_epa.gif", // BrandingSettings.getInstance().getHeaderLogo() + "_epa.gif", PageContext.REQUEST_SCOPE); pageContext.include("/WEB-INF/jspf/common/templates/page/CappHeader.jspf"); return true; }
private List<Task> getTasksToDisplay() { final List<Task> tasksToDisplay = new LinkedList<Task>(); final UserContext userContext = UserContext.getInstanceFromPageContext(pageContext); final boolean isAdmin = userContext.hasRequiredRole(IUserManager.ROLE_ADMIN); final ITaskManager taskManager = ManagementContainer.getInstance().getTaskManager(); final Calendar whenCompleted = Calendar.getInstance(TimeZone.getTimeZone("GMT")); whenCompleted.setTime((Date) pageContext.getSession().getAttribute("ems.session.start.time")); whenCompleted.add(Calendar.DAY_OF_YEAR, -1); final Date searchDate = whenCompleted.getTime(); final List<Task> tasks = taskManager.getDisplayedTasks(userContext.getCurrentCustomer().getCustID(), searchDate); final IReviewerGroupManager rgm = ManagementContainer.getInstance().getReviewerGroupManager(); final Collection<ReviewerGroup> reviewerGroups = rgm.getReviewerGroups( userContext.getCurrentCustomer().getCustID(), userContext.getActualUser().getUserID()); final List<Integer> reviewerGroupIdList = CollectionBuilder.buildList(reviewerGroups, ReviewerGroup.getReviewerGroupIdFunction()); for (final Task task : tasks) { if (isAdmin || userContext.getActualUser().getUserID() == task.getUserID() || reviewerGroupIdList.contains(task.getInternalData())) { if (getType() == null || getType().equals(task.getType())) { tasksToDisplay.add(task); } } } return tasksToDisplay; }