NIHVIVO-2279 Remove LoginStatusBean methods isLoggedInAtLeast() and isLoggedInExactly()

This commit is contained in:
j2blake 2011-06-06 13:39:37 +00:00
parent 320ca3c8b0
commit a8b74facd1
3 changed files with 7 additions and 12 deletions

View file

@ -168,14 +168,6 @@ public class LoginStatusBean {
return authenticationSource != AuthenticationSource.UNKNOWN;
}
public boolean isLoggedInExactly(int level) {
return securityLevel == level;
}
public boolean isLoggedInAtLeast(int minimumLevel) {
return securityLevel >= minimumLevel;
}
public boolean hasExternalAuthentication() {
return authenticationSource == AuthenticationSource.EXTERNAL;
}

View file

@ -17,6 +17,7 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
import edu.cornell.mannlib.vitro.webapp.beans.User;
import edu.cornell.mannlib.vitro.webapp.controller.edit.Authenticate;
@ -155,8 +156,9 @@ public class BasicAuthenticator extends Authenticator {
* Editors and other privileged users get a longer timeout interval.
*/
private void setSessionTimeoutLimit(HttpSession session) {
if (LoginStatusBean.getBean(session).isLoggedInAtLeast(
LoginStatusBean.EDITOR)) {
RoleLevel role = RoleLevel.getRoleFromLoginStatus(request);
if (role == RoleLevel.EDITOR || role == RoleLevel.CURATOR
|| role == RoleLevel.DB_ADMIN) {
session.setMaxInactiveInterval(PRIVILEGED_TIMEOUT_INTERVAL);
} else {
session.setMaxInactiveInterval(LOGGED_IN_TIMEOUT_INTERVAL);

View file

@ -15,6 +15,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
import edu.cornell.mannlib.vitro.webapp.beans.User;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
@ -152,8 +153,8 @@ public class LoginRedirector {
}
private boolean isMerelySelfEditor() {
return LoginStatusBean.getBean(session).isLoggedInExactly(
LoginStatusBean.NON_EDITOR);
RoleLevel role = RoleLevel.getRoleFromLoginStatus(request);
return role == RoleLevel.PUBLIC || role == RoleLevel.SELF;
}
private boolean isLoginPage(String page) {