public static void addPrivilege(
      PartialPath path,
      PrivilegeType priv,
      List<PathPrivilege> privilegeList,
      boolean grantOption) {
    PathPrivilege targetPathPrivilege = null;
    // check PathPrivilege of target path is already existed
    for (PathPrivilege pathPrivilege : privilegeList) {
      if (pathPrivilege.getPath().equals(path)) {
        targetPathPrivilege = pathPrivilege;
        break;
      }
    }
    // if not, then create new PathPrivilege
    if (targetPathPrivilege == null) {
      targetPathPrivilege = new PathPrivilege(path);
      privilegeList.add(targetPathPrivilege);
    }
    // add privilegeId into targetPathPrivilege
    targetPathPrivilege.grantPrivilege(priv, grantOption);
  }
Add privilege

@param path series path
@param priv privilege type
@param privilegeList privileges in List structure of user or role
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/AuthUtils.java