public User validateCallerWithFilterUser(User caller, TablePermission tPerm, String inputUserName)
    throws IOException {
    User filterUser = null;
    if (!caller.getShortName().equals(inputUserName)) {
      // User should have admin privilege if checking permission for other users
      requirePermission(caller, "hasPermission", tPerm.getTableName(), tPerm.getFamily(),
        tPerm.getQualifier(), inputUserName, Action.ADMIN);
      // Initialize user instance for the input user name
      List<String> groups = getUserGroups(inputUserName);
      filterUser = new InputUser(inputUserName, groups.toArray(new String[groups.size()]));
    } else {
      // User don't need ADMIN privilege for self check.
      // Setting action as null in AuthResult to display empty action in audit log
      AuthResult result = AuthResult.allow("hasPermission", "Self user validation allowed", caller,
        null, tPerm.getTableName(), tPerm.getFamily(), tPerm.getQualifier());
      logResult(result);
      filterUser = caller;
    }
    return filterUser;
  }
Check if caller is granting or revoking superusers's or supergroups's permissions.
@param request         request name
@param caller          caller
@param userToBeChecked target user or group
@throws IOException AccessDeniedException if target user is superuser
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessChecker.java