/* (non-Javadoc)
   * @see com.openedit.action.Command#execute(java.util.Map, java.util.Map)
   */
  public void execute(WebPageRequest inReq) throws OpenEditException {
    configure(inReq);
    Page page = (Page) inReq.getPage(); // urlUtils.requestPath();
    String requestPath = page.getPath();

    if (!inExcludeList(requestPath)) {
      Permission filter = inReq.getPage().getPermission("view");
      if ((filter != null)) {
        if (!filter.passes(inReq)) {
          if (isForbid()) {
            if (inReq.getResponse() != null) {
              inReq.getResponse().setStatus(HttpServletResponse.SC_FORBIDDEN);
              inReq.setHasRedirected(true);
            }
          } else {
            log.error("No view permission for " + page.getPath() + " sending redirect");
            inReq.putPageValue(
                "oe-exception", "You do not have permission to view " + page.getPath());

            // this is the original page someone might have been on. Used in login
            inReq.putSessionValue("originalEntryPage", inReq.getContentPage().getPath());
            String fullOriginalEntryPage = (String) inReq.getSessionValue("fullOriginalEntryPage");
            if (fullOriginalEntryPage == null) {
              inReq.putSessionValue("fullOriginalEntryPage", inReq.getPathUrlWithoutContext());
            }
            inReq.redirect(getLoginPath());
          }
        }
      } else {
        log.info("No view restrictions have been set for " + requestPath);
      }
    }
  }