@Override
  public Set<PrivilegeType> getPrivileges(String userName, PartialPath path) throws AuthException {
    User user = userManager.getEntity(userName);
    if (user == null) {
      throw new AuthException(
          TSStatusCode.USER_NOT_EXIST, String.format(NO_SUCH_USER_EXCEPTION, userName));
    }
    // get privileges of the user
    Set<PrivilegeType> privileges = user.getPathPrivileges(path);
    // merge the privileges of the roles of the user
    for (String roleName : user.getRoleSet()) {
      Role role = roleManager.getEntity(roleName);
      if (role != null) {
        privileges.addAll(role.getPathPrivileges(path));
      }
    }
    return privileges;
  }
Checks if a user has admin privileges
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/authorizer/BasicAuthorizer.java