[full-ci] [tests-only] Backport PR 8046, 8047 (#8078)

* Added test for sending share invitation to user with permissions

* Added test for sending share invitation to group with permissions
This commit is contained in:
Prarup Gurung
2023-12-28 12:12:28 +05:45
committed by GitHub
parent bf40d9d7dd
commit a3f481f3a0
3 changed files with 408 additions and 2 deletions
+11 -1
View File
@@ -1547,6 +1547,7 @@ class GraphHelper {
*
* @return string
*
* @throws \Exception
*/
public static function getRoleIdByName(
string $role
@@ -1568,6 +1569,8 @@ class GraphHelper {
return '1c996275-f1c9-4e71-abdf-a42f6495e960';
case 'Manager':
return '312c0871-5ef7-4b3a-85b6-0e4074c64049';
default:
throw new \Exception('Role ' . $role . ' not found');
}
}
@@ -1581,9 +1584,11 @@ class GraphHelper {
* @param string $shareeId
* @param string $shareType
* @param string|null $role
* @param string|null $permission
*
* @return ResponseInterface
* @throws \JsonException
* @throws \Exception
*/
public static function sendSharingInvitation(
string $baseUrl,
@@ -1594,7 +1599,8 @@ class GraphHelper {
string $itemId,
string $shareeId,
string $shareType,
?string $role
?string $role,
?string $permission
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/invite");
$body = [];
@@ -1609,6 +1615,10 @@ class GraphHelper {
$body['roles'] = [$roleId];
}
if ($permission !== null) {
$body['@libre.graph.permissions.actions'] = ['libre.graph/driveItem/' . $permission];
}
return HttpRequestHelper::post(
$url,
$xRequestId,