private void authorizeAddPartition(PreAddPartitionEvent context)
      throws InvalidOperationException, MetaException {
    try {
      for (org.apache.hadoop.hive.metastore.api.Partition mapiPart : context.getPartitions()) {
        org.apache.hadoop.hive.ql.metadata.Partition wrappedPartiton = new PartitionWrapper(
            mapiPart, context);
    for(HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()){
          authorizer.authorize(wrappedPartiton,
              HiveOperation.ALTERTABLE_ADDPARTS.getInputRequiredPrivileges(),
              HiveOperation.ALTERTABLE_ADDPARTS.getOutputRequiredPrivileges());
        }
      }
    } catch (AuthorizationException | NoSuchObjectException e) {
      throw invalidOperationException(e);
    } catch (HiveException e) {
      throw metaException(e);
    }
  }
AuthorizationPreEventListener : A MetaStorePreEventListener that
performs authorization/authentication checks on the metastore-side.

Note that this can only perform authorization checks on defined
metastore PreEventContexts, such as the adding/dropping and altering
of databases, tables and partitions.
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java