org.visallo.core.model.user.UserRepository.toJsonWithAuths()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中org.visallo.core.model.user.UserRepository.toJsonWithAuths()方法的一些代码示例,展示了UserRepository.toJsonWithAuths()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UserRepository.toJsonWithAuths()方法的具体详情如下:
包路径:org.visallo.core.model.user.UserRepository
类名称:UserRepository
方法名:toJsonWithAuths

UserRepository.toJsonWithAuths介绍

暂无

代码示例

代码示例来源:origin: org.visallo/visallo-core

public void pushUserAccessChange(User user) {
  JSONObject json = new JSONObject();
  json.put("type", "userAccessChange");
  json.put("permissions", getPermissionsWithUserIds(user.getUserId()));
  json.put("data", getUserRepository().toJsonWithAuths(user));
  broadcastJson(json);
}

代码示例来源:origin: org.visallo/visallo-web-plugins-admin-user-property-auth

@Handle
  public JSONObject handle(
      @Required(name = "user-name") String userName,
      @Required(name = "auth") String auth,
      User authUser
  ) throws Exception {
    User user = userRepository.findByUsername(userName);
    if (user == null) {
      throw new VisalloResourceNotFoundException("User " + userName + " not found");
    }

    if (!(authorizationRepository instanceof UpdatableAuthorizationRepository)) {
      throw new VisalloAccessDeniedException("Authorization repository does not support updating", authUser, userName);
    }

    for (String authStr : auth.split(SEPARATOR)) {
      ((UpdatableAuthorizationRepository) authorizationRepository).addAuthorization(user, authStr, authUser);
    }

    return userRepository.toJsonWithAuths(user);
  }
}

代码示例来源:origin: org.visallo/visallo-web-plugins-admin-user-property-privileges

@Handle
  public JSONObject handle(
      @Required(name = "user-name") String userName,
      @Required(name = "privileges") String privilegesParameter,
      User authUser
  ) throws Exception {
    Set<String> privileges = Privilege.stringToPrivileges(privilegesParameter);

    User user = userRepository.findByUsername(userName);
    if (user == null) {
      throw new VisalloResourceNotFoundException("Could not find user: " + userName);
    }

    privilegeRepository.setPrivileges(user, privileges, authUser);

    return userRepository.toJsonWithAuths(user);
  }
}

代码示例来源:origin: org.visallo/visallo-web-plugins-admin-user-property-auth

@Handle
  public JSONObject handle(
      @Required(name = "user-name") String userName,
      @Required(name = "auth") String auth,
      User authUser
  ) throws Exception {
    User user = userRepository.findByUsername(userName);
    if (user == null) {
      throw new VisalloResourceNotFoundException("Could not find user: " + userName);
    }

    if (!(authorizationRepository instanceof UpdatableAuthorizationRepository)) {
      throw new VisalloAccessDeniedException("Authorization repository does not support updating", authUser, userName);
    }

    ((UpdatableAuthorizationRepository) authorizationRepository).removeAuthorization(user, auth, authUser);
    return userRepository.toJsonWithAuths(user);
  }
}

相关文章