@Override public boolean isInRole(String role) { if (anonymous != null) { return true; } UserInfo user = getUser(); return user != null && (!"ADMIN".equals(role) || user.isAdmin()); }
@Inject public UserHttpContext(ZicoConfig config, UserManager userManager) { String mode = config.stringCfg("auth", "form"); this.userManager = userManager; if ("anonymous".equals(mode)) { anonymous = new UserInfo(); anonymous.setAdmin(true); anonymous.setUserName("anonymous"); anonymous.setRealName("Anonymous"); } }