Forward port getallgroupmemberswithallmembers to master (#5658)

* Added graph API test for getting all groups along with its members

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

* Refactor implementation code

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

* PR address

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

* Update the local api expected to failure

* Review Address

---------

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
Sagar Gurung
2023-02-27 11:16:50 +05:45
committed by GitHub
parent 8ec167d792
commit 028ca42fed
4 changed files with 160 additions and 0 deletions
+31
View File
@@ -586,6 +586,37 @@ class GraphHelper {
);
}
/**
* returns single group information along with its member information when groupId is provided
* else return all group information along with its member information
*
* @param string $baseUrl
* @param string $xRequestId
* @param string $adminUser
* @param string $adminPassword
* @param string|null $groupId
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function getSingleOrAllGroupsAlongWithMembers(
string $baseUrl,
string $xRequestId,
string $adminUser,
string $adminPassword,
?string $groupId = null
): ResponseInterface {
// we can expand to get list of members for a single group with groupId and also expand to get all groups with all its members
$endPath = ($groupId) ? '/' . $groupId . '?$expand=members' : '?$expand=members';
$url = self::getFullUrl($baseUrl, 'groups' . $endPath);
return HttpRequestHelper::get(
$url,
$xRequestId,
$adminUser,
$adminPassword
);
}
/**
* returns json encoded payload for user creating request
*