apiTest: listPermissions (#7946)

* apiTest: listPermissions

* fix after review

* fix
This commit is contained in:
Viktor Scharf
2023-12-13 12:34:49 +01:00
committed by GitHub
parent 0f72f018cc
commit b4d1feea5f
5 changed files with 402 additions and 0 deletions
+40
View File
@@ -97,6 +97,17 @@ class GraphHelper {
return $fullUrl;
}
/**
* @param string $baseUrl
* @param string $path
*
* @return string
*/
public static function getBetaFullUrl(string $baseUrl, string $path): string {
$baseUrl = rtrim($baseUrl, "/");
return $baseUrl . '/graph/v1beta1/' . $path;
}
/**
* @param string $baseUrl
* @param string $xRequestId
@@ -1492,4 +1503,33 @@ class GraphHelper {
$payload['preferredLanguage'] = $language;
return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PATCH', $user, $password, null, \json_encode($payload));
}
/**
* @param string $baseUrl
* @param string $xRequestId
* @param string $user
* @param string $password
* @param string $spaceId
* @param string $itemId
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function getPermissionsList(
string $baseUrl,
string $xRequestId,
string $user,
string $password,
string $spaceId,
string $itemId
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/permissions");
return HttpRequestHelper::get(
$url,
$xRequestId,
$user,
$password,
self::getRequestHeaders()
);
}
}