static void authorize(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges,
      HivePrivilegeObject hivePrivObject, boolean grantOption, IMetaStoreClient metastoreClient,
      String userName, List<String> curRoles, boolean isAdmin)
          throws HiveAuthzPluginException, HiveAccessControlException {

    // check if this user has grant privileges for this privileges on this
    // object

    // map priv being granted to required privileges
    RequiredPrivileges reqPrivs = getGrantRequiredPrivileges(hivePrivileges);

    // check if this user has necessary privileges (reqPrivs) on this object
    checkRequiredPrivileges(reqPrivs, hivePrivObject, metastoreClient, userName, curRoles, isAdmin,
        HiveOperationType.GRANT_PRIVILEGE);
  }
Utility class to authorize grant/revoke privileges
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/GrantPrivAuthUtils.java