private boolean authorizeUserAndDBPriv(Database db,
      Privilege[] inputRequiredPriv, Privilege[] outputRequiredPriv,
      boolean[] inputCheck, boolean[] outputCheck) throws HiveException {
    if (authorizeUserPriv(inputRequiredPriv, inputCheck, outputRequiredPriv,
        outputCheck)) {
      return true;
    }

    PrincipalPrivilegeSet dbPrivileges = hive_db.get_privilege_set(
        HiveObjectType.DATABASE, db.getName(), null, null, null, this
            .getAuthenticator().getUserName(), this.getAuthenticator()
            .getGroupNames());

    if (authorizePrivileges(dbPrivileges, inputRequiredPriv, inputCheck,
        outputRequiredPriv, outputCheck)) {
      return true;
    }

    return false;
  }
Check privileges on User and DB. This is used before doing a check on
table/partition objects, first check the user and DB privileges. If it
passed on this check, no need to check against the table/partition hive
object.

@param db
@param inputRequiredPriv
@param outputRequiredPriv
@param inputCheck
@param outputCheck
@return true if the check on user and DB privilege passed, which means no
        need for privilege check on concrete hive objects.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/BitSetCheckedAuthorizationProvider.java