src/Plugin/User.php
public function compareUserGroups(Userinfo $userinfo, $usergroups) {
		if (!is_array($usergroups)) {
			$usergroups = array($usergroups);
		}
		$correct = false;

		$count = 0;
		if (count($usergroups) == count($userinfo->groups)) {
			foreach ($usergroups as $group) {
				if (in_array($group, $userinfo->groups, true)) {
					$count++;
				}
			}
			if (count($userinfo->groups) == $count) {
				$correct = true;
			}
		}

		return $correct;
	}
public function compareUserGroups(Userinfo $userinfo, $usergroups) {
		if (!is_array($usergroups)) {
			$usergroups = array($usergroups);
		}
		$correct = false;

		$count = 0;
		if (count($usergroups) == count($userinfo->groups)) {
			foreach ($usergroups as $group) {
				if (in_array($group, $userinfo->groups, true)) {
					$count++;
				}
			}
			if (count($userinfo->groups) == $count) {
				$correct = true;
			}
		}

		return $correct;
	}
public function compareUserGroups ( Userinfo $ userinfo , $ usergroups ) { if ( ! is_array ( $ usergroups ) ) { $ usergroups = array ( $ usergroups ) ; } $ correct = false ; $ count = 0 ; if ( count ( $ usergroups ) == count ( $ userinfo -> groups ) ) { foreach ( $ usergroups as $ group ) { if ( in_array ( $ group , $ userinfo -> groups , true ) ) { $ count ++ ; } } if ( count ( $ userinfo -> groups ) == $ count ) { $ correct = true ; } } return $ correct ; }
compare set of usergroup with a user returns true if the usergroups are correct

@param Userinfo $userinfo user with current usergroups
@param array $usergroups array with the correct usergroups

@return boolean
compare set of usergroup with a user returns true if the usergroups are correct