[tests-only]tests: add tests for removing share permission in group share (#8099)

* tests: add tests for removing share permission in group share

* tests: address reviews
This commit is contained in:
Swikriti Tripathi
2024-01-04 17:03:39 +05:45
committed by GitHub
parent 672a38bf98
commit 2b78753a12
3 changed files with 98 additions and 23 deletions
+10 -8
View File
@@ -1543,11 +1543,12 @@ class GraphHelper {
/**
* @param string $baseUrl
* @param string $xRequestId
* @param string $user
* @param string $userIdOfShareeUser
* @param string $sharer
* @param string $userIdOfShareeUser this is a uuidv4 of sharee
* @param string $password
* @param string $spaceId
* @param string $itemId
* @param string $shareType (user|group)
*
* @return string
*
@@ -1557,22 +1558,23 @@ class GraphHelper {
public static function getSharePermissionId(
string $baseUrl,
string $xRequestId,
string $user,
string $sharer,
string $userIdOfShareeUser,
string $password,
string $spaceId,
string $itemId
string $itemId,
string $shareType
): string {
$response = self::getPermissionsList($baseUrl, $xRequestId, $user, $password, $spaceId, $itemId);
$response = self::getPermissionsList($baseUrl, $xRequestId, $sharer, $password, $spaceId, $itemId);
$permissionList = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
foreach ($permissionList["value"] as $value) {
if ($value["grantedToV2"]["user"]["id"] === $userIdOfShareeUser) {
if ($value["grantedToV2"][$shareType]["id"] === $userIdOfShareeUser) {
return $value["id"];
}
}
throw new \Exception(
__METHOD__
. " Cannot find share permission id for user '$user'"
. " Cannot find share permission id for user"
);
}
@@ -1751,7 +1753,7 @@ class GraphHelper {
*
* @throws GuzzleException
*/
public static function deleteSharePermission(
public static function removeSharePermission(
string $baseUrl,
string $xRequestId,
string $user,