NIHVIVO-736 transitioning from LoginFormBean to LoginStatusBean.

This commit is contained in:
jeb228 2010-10-13 15:54:11 +00:00
parent 4dbf19c9c0
commit 02e32428bd
6 changed files with 30 additions and 106 deletions

View file

@ -7,19 +7,10 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.*"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%/* this odd thing points to something in web.xml */ %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
/**
* @version 1.00
* @author Jon Corson-Rikert
* UPDATES:
* 2006-01-04 bdc removed <head> and <body> tags and moved from <table> to <div>
* 2005-07-07 JCR included LoginFormBean so can substitute filterbrowse for portalbrowse for authorized users
*/
final Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.web.themes.default.footer.jsp");
VitroRequest vreq = new VitroRequest(request);
@ -28,14 +19,8 @@
if (portal==null) {
log.error("portal from vreq.getPortal() null in themes/default/footer.jsp");
}
HttpSession currentSession = request.getSession();
boolean authorized = false;
if (loginHandler.getLoginStatus().equals("authenticated")) /* test if session is still valid */
if (currentSession.getId().equals(loginHandler.getSessionId()))
if (request.getRemoteAddr().equals(
loginHandler.getLoginRemoteAddr()))
authorized = true;
boolean isEditor = LoginStatusBean.getBean(request).isLoggedInAtLeast(LoginStatusBean.EDITOR);
%>
<c:set var="currentYear" value="<%= Calendar.getInstance().get(Calendar.YEAR) %>" />
<div class='footer'><div class='footerLinks'>
@ -43,14 +28,14 @@
if (rootBreadCrumb != null && rootBreadCrumb.length()>0) { %>
<%=rootBreadCrumb%> |
<% } %>
<a href="<%=(authorized?"browsecontroller":"browsecontroller")%>?home=<%=portal.getPortalId()%>">Index</a>
<a href="browsecontroller?home=<%=portal.getPortalId()%>">Index</a>
| <a href="comments?home=<%=portal.getPortalId()%>">Contact Us</a>
<c:if test="${sessionScope.loginHandler.loginStatus == 'authenticated' && sessionScope.loginHandler.loginRole > 3 }">
<% if (isEditor) { %>
| admin [
<a href="http://validator.w3.org/check?uri=referer">validate xhtml</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">validate css</a>
]
</c:if>
<% } %>
</div>
<% if (portal.getCopyrightAnchor() != null && portal.getCopyrightAnchor().length()>0) { %>
<div class='copyright'>

View file

@ -6,47 +6,21 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%><%/* this odd thing points to something in web.xml */ %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.PortalWebUtil" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
/**
*
* @version 1.00
* @author Jon Corson-Rikert, Brian Caruso, and Brian Lowe
*
* UPDATES:
* 2007-09-27 BJL moved VIVO and CALS-specific markup to VIVO clone
* 2006-01-31 BJL edited to remove deprecated markup
* 2005-11-06 JCR put styling on extra search selection box
* 2005-10-25 JCR changed local ALL CALS RESEARCH constant to appBean.getSharedPortalFlagNumeric()
* 2005-10-11 JCR tweaks to VIVO search label spacing in header
* 2005-09-15 JCR,BDC converted to use revised ApplicationBean and PortalBean
* 2005-08-16 JCR added CALS_IMPACT contant and modified code to use CALS display for that portal
* 2005-08-01 JCR changed ordering of other portals being displayed to displayRank instead of appName (affects SGER, CALS portals)
* 2005-07-05 JCR retrieving ONLY_CURRENT and ONLY_PUBLIC from database and setting in ApplicationBean
* 2005-06-20 JCR enabling a common CALS research portal via ALL CALS RESEARCH
* 2005-06-20 JCR removed MIN_STATUS_ID and minstatus parameter from search -- has been changed to interactive-only maxstatus parameter
* JCR 2005-06-14 : added isInitialized() test for appBean and portalBean
*/
// application variables not stored in application bean
final int CALS_IMPACT = 6;
final int FILTER_SECURITY_LEVEL = 4;
final int CALS_SEARCHBOX_SIZE = 25;
final int VIVO_SEARCHBOX_SIZE = 20;
HttpSession currentSession = request.getSession();
String currentSessionIdStr = currentSession.getId();
int securityLevel = -1;
String loginName = null;
if (loginHandler.testSessionLevel(request) > -1) {
securityLevel = Integer.parseInt(loginHandler.getLoginRole());
loginName = loginHandler.getLoginName();
}
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
boolean isEditor = loginBean.isLoggedInAtLeast(LoginStatusBean.EDITOR);
String loginName = loginBean.getUsername();
VitroRequest vreq = new VitroRequest(request);
ApplicationBean appBean = vreq.getAppBean();
@ -106,7 +80,7 @@
<label for="search">Search </label>
</td>
<td>
<% if (securityLevel>=FILTER_SECURITY_LEVEL && appBean.isFlag1Active()) { %>
<% if (isEditor && appBean.isFlag1Active()) { %>
<select id="select" name="flag1" class="form-item" >
<option value="nofiltering" selected="selected">entire database (<%=loginName%>)</option>
<option value="<%=portal.getPortalId()%>"><%=portal.getShortHand()%></option>

View file

@ -8,10 +8,9 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.BreadCrumbsUtil" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
/***********************************************
Make the Tab menu div, nothing else.
@ -19,14 +18,9 @@
bdc34 2006-01-03 created
**********************************************/
HttpSession currentSession = request.getSession();
String currentSessionIdStr = currentSession.getId();
int securityLevel = -1;
String loginName = null;
if (loginHandler.testSessionLevel(request) > -1) {
securityLevel = Integer.parseInt(loginHandler.getLoginRole());
loginName = loginHandler.getLoginName();
}
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
boolean isLoggedIn = loginBean.isLoggedIn();
String loginName = loginBean.getUsername();
final Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.web.menu.jsp");
@ -51,7 +45,7 @@
<ul id="otherMenu">
<%-- A user is logged in --%>
<% if (securityLevel > 0) { %>
<% if (isLoggedIn) { %>
<c:url var="logoutHref" value="<%= Controllers.LOGOUT_JSP %>">
<c:param name="home" value="${currentPortal}" />

View file

@ -12,16 +12,7 @@
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%/* this odd thing points to something in web.xml */ %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
/**
* @version 1.00
* @author Jon Corson-Rikert
* UPDATES:
* 2006-01-04 bdc removed <head> and <body> tags and moved from <table> to <div>
* 2005-07-07 JCR included LoginFormBean so can substitute filterbrowse for portalbrowse for authorized users
*/
final Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.web.themes.enhanced.footer.jsp");
VitroRequest vreq = new VitroRequest(request);
@ -30,14 +21,6 @@
if (portal==null) {
log.error("portal from vreq.getPortal() null in themes/enhanced/footer.jsp");
}
HttpSession currentSession = request.getSession();
boolean authorized = false;
if (loginHandler.getLoginStatus().equals("authenticated")) /* test if session is still valid */
if (currentSession.getId().equals(loginHandler.getSessionId()))
if (request.getRemoteAddr().equals(
loginHandler.getLoginRemoteAddr()))
authorized = true;
%>
<c:set var="currentYear" value="<%= Calendar.getInstance().get(Calendar.YEAR) %>" />
<c:set var='context' value="<%=vreq.getContextPath()%>" />

View file

@ -10,20 +10,15 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.BreadCrumbsUtil" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
HttpSession currentSession = request.getSession();
String currentSessionIdStr = currentSession.getId();
int securityLevel = -1;
String loginName = null;
if (loginHandler.testSessionLevel(request) > -1) {
securityLevel = Integer.parseInt(loginHandler.getLoginRole());
loginName = loginHandler.getLoginName();
}
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
boolean isLoggedIn = loginBean.isLoggedIn();
String loginName = loginBean.getUsername();
// VITRO FILE
final Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.web.menu.jsp");
@ -74,7 +69,7 @@ portal.getRootBreadCrumbURL() : request.getContextPath()+"/";
<ul id="otherMenu">
<%-- A user is logged in --%>
<% if (securityLevel > 0) { %>
<% if (isLoggedIn) { %>
<c:url var="logoutHref" value="<%= Controllers.LOGOUT_JSP %>">
<c:param name="home" value="${currentPortal}" />

View file

@ -10,12 +10,12 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.TabWebUtil" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.PortalWebUtil" %>
<%@page import="java.util.List"%>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %>
<%@ page import="java.util.List"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
/***********************************************
Make the Tab menu list and search block
@ -57,22 +57,15 @@
// application variables not stored in application bean
final String DEFAULT_SEARCH_METHOD = "fulltext";
final int FILTER_SECURITY_LEVEL = 4;
final int VIVO_SEARCHBOX_SIZE = 20;
ApplicationBean appBean = vreq.getAppBean();
PortalWebUtil.populateSearchOptions(portal, appBean, vreq.getWebappDaoFactory().getPortalDao());
PortalWebUtil.populateNavigationChoices(portal, request, appBean, vreq.getWebappDaoFactory().getPortalDao());
HttpSession currentSession = request.getSession();
String currentSessionIdStr = currentSession.getId();
int securityLevel = -1;
String loginName = null;
if (loginHandler.testSessionLevel(request) > -1) {
securityLevel = Integer.parseInt(loginHandler.getLoginRole());
loginName = loginHandler.getLoginName();
}
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
boolean isEditor = loginBean.isLoggedInAtLeast(LoginStatusBean.EDITOR);
String loginName = loginBean.getUsername();
%>
<c:url var="themePath" value="/${themeDir}" />
@ -118,7 +111,7 @@
<div id="searchBlock">
<form id="searchForm" action="${searchURL}" >
<label for="search">Search </label>
<% if (securityLevel>=FILTER_SECURITY_LEVEL && appBean.isFlag1Active()) { %>
<% if (isEditor && appBean.isFlag1Active()) { %>
<select id="search-form-modifier" name="flag1" class="form-item" >
<option value="nofiltering" selected="selected">entire database (<%=loginName%>)</option>
<option value="${currentPortal}"><%=portal.getShortHand()%></option>