private void ensureShowGrantAllowed(HivePrincipal principal)
      throws HiveAccessControlException, HiveAuthzPluginException {
    // if user is not an admin user, allow the request only if the user is
    // requesting for privileges for themselves or a role they belong to
    switch (principal.getType()) {
    case USER:
      if (!principal.getName().equals(currentUserName)) {
        throw new HiveAccessControlException("User : " + currentUserName + " is not"
            + " allowed check privileges of another user : " + principal.getName() + ". "
            + ADMIN_ONLY_MSG);
      }
      break;
    case ROLE:
      if (!userBelongsToRole(principal.getName())) {
        throw new HiveAccessControlException("User : " + currentUserName + " is not"
            + " allowed check privileges of a role it does not belong to : "
            + principal.getName() + ". " + ADMIN_ONLY_MSG);
      }
      break;
    default:
      throw new AssertionError("Unexpected principal type " + principal.getType());
    }
  }
Add role names of parentRoles and its parents to processedRolesMap

@param processedRolesMap
@param roleGrants
@throws TException
@throws HiveAuthzPluginException
@throws MetaException
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLStdHiveAccessController.java