List of usage examples for javax.servlet.http HttpServletRequest isUserInRole
public boolean isUserInRole(String role);
From source file:com.googlecode.psiprobe.tools.SecurityUtils.java
private static boolean userHasRole(String privilegedRole, HttpServletRequest request) { return request.isUserInRole(privilegedRole); }
From source file:psiprobe.tools.SecurityUtils.java
/** * User has role./*from w w w.j a va2s. com*/ * * @param privilegedRole the privileged role * @param request the request * @return true, if successful */ @SuppressWarnings("unused") private static boolean userHasRole(String privilegedRole, HttpServletRequest request) { return request.isUserInRole(privilegedRole); }
From source file:cn.edu.zjnu.acm.judge.service.UserDetailService.java
public static boolean isAdminLoginned(HttpServletRequest request) { return request.isUserInRole("ADMIN"); }
From source file:cn.edu.zjnu.acm.judge.service.UserDetailService.java
public static boolean isSourceBrowser(HttpServletRequest request) { return request.isUserInRole("SOURCE_BROWSER"); }
From source file:org.ala.spatial.services.utils.Utilities.java
public static boolean isUserAdmin(HttpServletRequest req) { if (!isLoggedIn(req)) return false; return req.isUserInRole(DEFAULT_SPATIAL_USER_ADMIN); }
From source file:org.apache.directory.fortress.web.control.SecUtils.java
/** * Wrapper for the httpservlet isUserInRole api. * * @param roleName contains the name of role being checked. * @param servletReq handle used to make inquiry. * @return true if authorized, false otherwise. *//*from w w w . ja v a 2 s . c o m*/ public static boolean isAuthorized(String roleName, HttpServletRequest servletReq) { boolean isAuthorized = false; if (servletReq.isUserInRole(roleName)) { isAuthorized = true; } return isAuthorized; }
From source file:architecture.ee.web.util.WebSiteUtils.java
public static boolean isUserAccessAllowed(HttpServletRequest request, MenuComponent menu) { if (StringUtils.isNotEmpty(menu.getRoles())) { for (String role : StringUtils.split(menu.getRoles(), ",")) { if (request.isUserInRole(role)) return true; }/* w w w.j a va2s . c o m*/ } else { return true; } return false; }
From source file:org.j2free.jsp.el.StandardExtensions.java
/** * * @param request/*from www . j a va 2s .c o m*/ * @param role * @return */ public static boolean isUserInRole(HttpServletRequest request, String role) { if (request == null || role == null) return false; return request.isUserInRole(role); }
From source file:com.betfair.tornjak.monitor.overlay.AuthUtils.java
/** * Returns null if user is not authenticated or authorised, otherwise returns Auth object. * // w w w.j a v a 2 s.c o m */ public static Auth checkAuthorised(final HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws IOException { RolePerms rolePerms = getOrCreateRolePerms(servletContext); Auth auth = new Auth(new Auth.Validator() { @Override public boolean isUserInRole(String role) { return request.isUserInRole(role); } @Override public boolean isAuthenticated() { return request.getUserPrincipal() != null; } }, rolePerms); switch (auth.check()) { case UNAUTHORISED: response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; case FORBIDDEN: response.sendError(HttpServletResponse.SC_FORBIDDEN); return null; default: return auth; } }
From source file:ips1ap101.lib.core.control.UsuarioAutenticado.java
static boolean isUserInRole(String role) { HttpServletRequest request = JSF.getRequest(); return request != null && request.isUserInRole(role); }