Пример #1
0
 @Override
 public boolean isInRole(String role) {
   if (anonymous != null) {
     return true;
   }
   UserInfo user = getUser();
   return user != null && (!"ADMIN".equals(role) || user.isAdmin());
 }
Пример #2
0
  @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");
    }
  }