NIHVIVO-1944 If user is logged in, but not at a sufficient level, show the "insufficient authorization" message.
This commit is contained in:
parent
b5f4714057
commit
7075521489
1 changed files with 12 additions and 4 deletions
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.web.jsptags;
|
package edu.cornell.mannlib.vitro.webapp.web.jsptags;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.JspException;
|
||||||
|
@ -73,7 +71,8 @@ public class ConfirmLoginStatus extends BodyTagSupport {
|
||||||
LogoutRedirector.recordRestrictedPageUri(getRequest());
|
LogoutRedirector.recordRestrictedPageUri(getRequest());
|
||||||
|
|
||||||
LoginStatusBean loginBean = LoginStatusBean.getBean(getRequest());
|
LoginStatusBean loginBean = LoginStatusBean.getBean(getRequest());
|
||||||
boolean isLoggedIn = loginBean.isLoggedInAtLeast(level);
|
boolean isLoggedIn = loginBean.isLoggedIn();
|
||||||
|
boolean isSufficient = loginBean.isLoggedInAtLeast(level);
|
||||||
|
|
||||||
boolean isSelfEditing = VitroRequestPrep.isSelfEditing(getRequest());
|
boolean isSelfEditing = VitroRequestPrep.isSelfEditing(getRequest());
|
||||||
|
|
||||||
|
@ -81,9 +80,12 @@ public class ConfirmLoginStatus extends BodyTagSupport {
|
||||||
+ ", requiredLevel=" + level + ", selfEditingAllowed="
|
+ ", requiredLevel=" + level + ", selfEditingAllowed="
|
||||||
+ allowSelfEditing + ", isSelfEditing=" + isSelfEditing);
|
+ allowSelfEditing + ", isSelfEditing=" + isSelfEditing);
|
||||||
|
|
||||||
if (isLoggedIn || (allowSelfEditing && isSelfEditing)) {
|
if (isSufficient || (allowSelfEditing && isSelfEditing)) {
|
||||||
log.debug("Login status confirmed.");
|
log.debug("Login status confirmed.");
|
||||||
return setBeanAndReturn(loginBean);
|
return setBeanAndReturn(loginBean);
|
||||||
|
} else if (isLoggedIn) {
|
||||||
|
log.debug("Logged in, but not sufficient.");
|
||||||
|
return showInsufficientAuthorizationMessage();
|
||||||
} else {
|
} else {
|
||||||
log.debug("Login status not confirmed.");
|
log.debug("Login status not confirmed.");
|
||||||
return redirectAndSkipPage();
|
return redirectAndSkipPage();
|
||||||
|
@ -98,6 +100,12 @@ public class ConfirmLoginStatus extends BodyTagSupport {
|
||||||
return EVAL_PAGE;
|
return EVAL_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int showInsufficientAuthorizationMessage() {
|
||||||
|
VitroHttpServlet.redirectToInsufficientAuthorizationPage(getRequest(),
|
||||||
|
getResponse());
|
||||||
|
return SKIP_PAGE;
|
||||||
|
}
|
||||||
|
|
||||||
private int redirectAndSkipPage() throws JspException {
|
private int redirectAndSkipPage() throws JspException {
|
||||||
VitroHttpServlet.redirectToLoginPage(getRequest(), getResponse());
|
VitroHttpServlet.redirectToLoginPage(getRequest(), getResponse());
|
||||||
return SKIP_PAGE;
|
return SKIP_PAGE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue