@Override
  public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj)
      throws HiveAuthzPluginException {
    try {

      // First authorize the call
      if (principal == null) {
        // only the admin is allowed to list privileges for any user
        if (!isUserAdmin()) {
          throw new HiveAccessControlException("User : " + currentUserName + " has to specify"
              + " a user name or role in the show grant. " + ADMIN_ONLY_MSG);
        }
      } else {
        //principal is specified, authorize on it
        if (!isUserAdmin()) {
          ensureShowGrantAllowed(principal);
        }
      }
      IMetaStoreClient mClient = metastoreClientFactory.getHiveMetastoreClient();
      List<HivePrivilegeInfo> resPrivInfos = new ArrayList<HivePrivilegeInfo>();
      String principalName = principal == null ? null : principal.getName();
      PrincipalType principalType = principal == null ? null :
          AuthorizationUtils.getThriftPrincipalType(principal.getType());

      // get metastore/thrift privilege object using metastore api
      List<HiveObjectPrivilege> msObjPrivs = mClient.list_privileges(principalName,
          principalType,
          SQLAuthorizationUtils.getThriftHiveObjectRef(privObj));


      // convert the metastore thrift objects to result objects
      for (HiveObjectPrivilege msObjPriv : msObjPrivs) {
        // result principal
        HivePrincipal resPrincipal = new HivePrincipal(msObjPriv.getPrincipalName(),
            AuthorizationUtils.getHivePrincipalType(msObjPriv.getPrincipalType()));

        // result privilege
        PrivilegeGrantInfo msGrantInfo = msObjPriv.getGrantInfo();
        HivePrivilege resPrivilege = new HivePrivilege(msGrantInfo.getPrivilege(), null);

        // result object
        HiveObjectRef msObjRef = msObjPriv.getHiveObject();

        if (!isSupportedObjectType(msObjRef.getObjectType())) {
          // metastore returns object type such as global GLOBAL
          // when no object is specified.
          // such privileges are not applicable to this authorization mode, so
          // ignore them
          continue;
        }

        HivePrivilegeObject resPrivObj = new HivePrivilegeObject(
            getPluginPrivilegeObjType(msObjRef.getObjectType()), msObjRef.getDbName(),
            msObjRef.getObjectName(), msObjRef.getPartValues(), msObjRef.getColumnName());

        // result grantor principal
        HivePrincipal grantorPrincipal = new HivePrincipal(msGrantInfo.getGrantor(),
            AuthorizationUtils.getHivePrincipalType(msGrantInfo.getGrantorType()));

        HivePrivilegeInfo resPrivInfo = new HivePrivilegeInfo(resPrincipal, resPrivilege,
            resPrivObj, grantorPrincipal, msGrantInfo.isGrantOption(), msGrantInfo.getCreateTime());
        resPrivInfos.add(resPrivInfo);
      }
      return resPrivInfos;

    } catch (Exception e) {
      throw SQLAuthorizationUtils.getPluginException("Error showing privileges", e);
    }

  }
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