Ejemplo n.º 1
0
  protected boolean isServletAllowed(ServletDescr d) {
    if (d.needsUserAdminRole() && !doesUserHaveRole(ROLE_USER_ADMIN)) return false;
    if (d.needsContentAdminRole() && !doesUserHaveRole(ROLE_CONTENT_ADMIN)) return false;
    if (d.needsAuAdminRole() && !doesUserHaveRole(ROLE_AU_ADMIN)) return false;

    return d.isEnabled(getLockssDaemon());
  }
Ejemplo n.º 2
0
 /**
  * Construct servlet URL, with params as necessary. Avoid generating a hostname different from
  * that used in the original request, or browsers will prompt again for login
  */
 String srvURLFromStem(String stem, ServletDescr d, String params) {
   if (d.isPathIsUrl()) {
     return d.getPath();
   }
   StringBuilder sb = new StringBuilder(80);
   if (stem != null) {
     sb.append(stem);
     if (stem.charAt(stem.length() - 1) != '/') {
       sb.append('/');
     }
   } else {
     // ensure absolute path even if no scheme/host/port
     sb.append('/');
   }
   sb.append(d.getPath());
   if (params != null) {
     sb.append('?');
     sb.append(params);
   }
   return sb.toString();
 }
Ejemplo n.º 3
0
 protected boolean isServletInNav(ServletDescr d) {
   if (d.cls == ServletDescr.UNAVAILABLE_SERVLET_MARKER) return false;
   return d.isInNav(this) && isServletDisplayed(d);
 }
Ejemplo n.º 4
0
 protected boolean isServletDisplayed(ServletDescr d) {
   if (!isServletAllowed(d)) return false;
   if (d.needsDebugRole() && !doesUserHaveRole(ROLE_DEBUG)) return false;
   return true;
 }