in backend/src/main/java/org/apache/iotdb/admin/service/impl/IotDBServiceImpl.java [1143:1185]
private void upsertAuthorityPrivilege(
SessionPool sessionPool,
String operationType,
String userOrRole,
String name,
String privilegesStr)
throws BaseException {
String show_version = executeQueryOneValue(sessionPool, "show version");
String sql = null;
if (show_version.contains("0.13") || show_version.contains("0.14")) {
sql =
operationType
+ " "
+ userOrRole
+ " "
+ name
+ " privileges "
+ privilegesStr
+ " on root";
} else if (show_version.contains("0.12")) {
sql =
operationType
+ " "
+ userOrRole
+ " "
+ name
+ " privileges '"
+ privilegesStr
+ "' on root";
}
try {
sessionPool.executeNonQueryStatement(sql);
} catch (StatementExecutionException e) {
logger.error(e.getMessage());
if (e.getStatusCode() == 602) {
throw new BaseException(
ErrorCode.NO_PRI_GRANT_PRIVILEGE, ErrorCode.NO_PRI_GRANT_PRIVILEGE_MSG);
}
} catch (IoTDBConnectionException e) {
logger.error(e.getMessage());
throw new BaseException(ErrorCode.GET_SESSION_FAIL, ErrorCode.GET_SESSION_FAIL_MSG);
}
}