in pan-domain-auth-core/src/main/scala/com/gu/pandomainauth/service/Google2FAGroupChecker.scala [59:64]
protected def hasGroup(query: Directory#Groups#List, groupId: String): Boolean =
withGoogle4xxErrorHandling {
val groupsResponse = query.execute()
val hasGroupOnPage = Option(groupsResponse.getGroups).exists(_.asScala.exists(_.getEmail == groupId))
hasGroupOnPage || (if(hasMoreGroups(groupsResponse)) hasGroup( query.setPageToken(groupsResponse.getNextPageToken), groupId ) else false)
}