[test-only] ApiTest. get users of members of several groups (#5575)

* get users with group filter

* fix test
This commit is contained in:
Viktor Scharf
2023-02-16 16:34:13 +01:00
committed by GitHub
parent e38dc12e55
commit 3e3d3f9de2
6 changed files with 236 additions and 81 deletions
+54
View File
@@ -1019,4 +1019,58 @@ class GraphHelper {
self::getRequestHeaders()
);
}
/**
* @param string $baseUrl
* @param string $xRequestId
* @param string $user
* @param string $password
* @param string $groupId
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function getUsersWithFilterMemberOf(
string $baseUrl,
string $xRequestId,
string $user,
string $password,
string $groupId
): ResponseInterface {
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$groupId')");
return HttpRequestHelper::get(
$url,
$xRequestId,
$user,
$password,
self::getRequestHeaders()
);
}
/**
* @param string $baseUrl
* @param string $xRequestId
* @param string $user
* @param string $password
* @param array $groupIdArray
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function getUsersOfTwoGroups(
string $baseUrl,
string $xRequestId,
string $user,
string $password,
array $groupIdArray
): ResponseInterface {
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$groupIdArray[0]') " . "and memberOf/any(m:m/id eq '$groupIdArray[1]')");
return HttpRequestHelper::get(
$url,
$xRequestId,
$user,
$password,
self::getRequestHeaders()
);
}
}