NIHVIVO-2299 Accept either an Actions object or a sequence of RequestedAction for authorization.
This commit is contained in:
parent
69dd3019a7
commit
42cee19d55
1 changed files with 15 additions and 2 deletions
|
@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
|
import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
|
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
|
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
|
||||||
|
|
||||||
|
@ -98,7 +99,19 @@ public class VitroHttpServlet extends HttpServlet {
|
||||||
* Don't display a page that the user isn't authorized to see.
|
* Don't display a page that the user isn't authorized to see.
|
||||||
*
|
*
|
||||||
* @param actions
|
* @param actions
|
||||||
* the RequestedActions that need to be authorized.
|
* the RequestedActions that must be authorized.
|
||||||
|
*/
|
||||||
|
protected boolean isAuthorizedToDisplayPage(HttpServletRequest request,
|
||||||
|
HttpServletResponse response, RequestedAction... actions) {
|
||||||
|
return isAuthorizedToDisplayPage(request, response,
|
||||||
|
new Actions(Arrays.asList(actions)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't display a page that the user isn't authorized to see.
|
||||||
|
*
|
||||||
|
* @param actions
|
||||||
|
* the combination of RequestedActions that must be authorized.
|
||||||
*/
|
*/
|
||||||
protected boolean isAuthorizedToDisplayPage(HttpServletRequest request,
|
protected boolean isAuthorizedToDisplayPage(HttpServletRequest request,
|
||||||
HttpServletResponse response, Actions actions) {
|
HttpServletResponse response, Actions actions) {
|
||||||
|
@ -112,7 +125,7 @@ public class VitroHttpServlet extends HttpServlet {
|
||||||
+ "' is authorized for actions: " + actions);
|
+ "' is authorized for actions: " + actions);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Servlet '" + this.getClass().getSimpleName()
|
log.debug("Servlet '" + this.getClass().getSimpleName()
|
||||||
+ "' is not authorized for actions: " + actions);
|
+ "' is not authorized for actions: " + actions);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue