public void userGrant()

in backend/src/main/java/org/apache/iotdb/admin/service/impl/IotDBServiceImpl.java [919:938]


  public void userGrant(Connection connection, String userName, UserGrantDTO userGrantDTO)
      throws BaseException {
    SessionPool sessionPool = getSessionPool(connection);
    List<String> roleList = userGrantDTO.getRoleList();
    List<String> cancelRoleList = userGrantDTO.getCancelRoleList();
    try {
      if (cancelRoleList != null && cancelRoleList.size() != 0) {
        for (String cancelRole : cancelRoleList) {
          revokeRole(sessionPool, userName, cancelRole);
        }
      }
      if (roleList != null && roleList.size() != 0) {
        for (String garntRole : roleList) {
          grantRole(sessionPool, userName, garntRole);
        }
      }
    } finally {
      closeSessionPool(sessionPool);
    }
  }