private void authorizeAlterDatabase(PreAlterDatabaseEvent context)
      throws InvalidOperationException, MetaException {
    try {
      for (HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()) {
        authorizer.authorize(new Database(context.getOldDatabase()),
            HiveOperation.ALTERDATABASE_LOCATION.getInputRequiredPrivileges(),
            HiveOperation.ALTERDATABASE_LOCATION.getOutputRequiredPrivileges());
      }
    } catch (AuthorizationException 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