Added test for sending share invitation to user with expiration
This commit is contained in:
@@ -1585,6 +1585,7 @@ class GraphHelper {
|
|||||||
* @param string $shareType
|
* @param string $shareType
|
||||||
* @param string|null $role
|
* @param string|null $role
|
||||||
* @param string|null $permission
|
* @param string|null $permission
|
||||||
|
* @param string|null $expireDate
|
||||||
*
|
*
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
* @throws \JsonException
|
* @throws \JsonException
|
||||||
@@ -1600,7 +1601,8 @@ class GraphHelper {
|
|||||||
string $shareeId,
|
string $shareeId,
|
||||||
string $shareType,
|
string $shareType,
|
||||||
?string $role,
|
?string $role,
|
||||||
?string $permission
|
?string $permission,
|
||||||
|
?string $expireDate
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/invite");
|
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/invite");
|
||||||
$body = [];
|
$body = [];
|
||||||
@@ -1619,6 +1621,10 @@ class GraphHelper {
|
|||||||
$body['@libre.graph.permissions.actions'] = ['libre.graph/driveItem/' . $permission];
|
$body['@libre.graph.permissions.actions'] = ['libre.graph/driveItem/' . $permission];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($expireDate !== null) {
|
||||||
|
$body['expirationDateTime'] = $expireDate;
|
||||||
|
}
|
||||||
|
|
||||||
return HttpRequestHelper::post(
|
return HttpRequestHelper::post(
|
||||||
$url,
|
$url,
|
||||||
$xRequestId,
|
$xRequestId,
|
||||||
|
|||||||
@@ -580,3 +580,97 @@ Feature: Send a sharing invitations
|
|||||||
| permissions/delete |
|
| permissions/delete |
|
||||||
| deleted/delete |
|
| deleted/delete |
|
||||||
| permissions/deny |
|
| permissions/deny |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario Outline: send share invitation with expiration date to user with different roles
|
||||||
|
Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt"
|
||||||
|
And user "Alice" has created folder "FolderToShare"
|
||||||
|
When user "Alice" sends the following share invitation using the Graph API:
|
||||||
|
| resourceType | <resource-type> |
|
||||||
|
| resource | <path> |
|
||||||
|
| space | Personal |
|
||||||
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| role | <role> |
|
||||||
|
| expireDate | 2043-07-15T14:00:00.000Z |
|
||||||
|
Then the HTTP status code should be "200"
|
||||||
|
And the JSON data of the response should match
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"value": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"roles",
|
||||||
|
"grantedToV2",
|
||||||
|
"expirationDateTime"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^%share_id_pattern%$"
|
||||||
|
},
|
||||||
|
"roles": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^%role_id_pattern%$"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"grantedToV2": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"user": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"displayName"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^%user_id_pattern%$"
|
||||||
|
},
|
||||||
|
"displayName": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Brian Murphy"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expirationDateTime": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"2043-07-15T14:00:00Z"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
Examples:
|
||||||
|
| role | resource-type | path |
|
||||||
|
| Viewer | file | /textfile1.txt |
|
||||||
|
| File Editor | file | /textfile1.txt |
|
||||||
|
| Co Owner | file | /textfile1.txt |
|
||||||
|
| Manager | file | /textfile1.txt |
|
||||||
|
| Viewer | folder | FolderToShare |
|
||||||
|
| Editor | folder | FolderToShare |
|
||||||
|
| Co Owner | folder | FolderToShare |
|
||||||
|
| Uploader | folder | FolderToShare |
|
||||||
|
| Manager | folder | FolderToShare |
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ class SharingNgContext implements Context {
|
|||||||
|
|
||||||
$role = $rows['role'] ?? null;
|
$role = $rows['role'] ?? null;
|
||||||
$permission = $rows['permission'] ?? null;
|
$permission = $rows['permission'] ?? null;
|
||||||
|
$expireDate = $rows["expireDate"] ?? null;
|
||||||
|
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
GraphHelper::sendSharingInvitation(
|
GraphHelper::sendSharingInvitation(
|
||||||
@@ -118,7 +119,8 @@ class SharingNgContext implements Context {
|
|||||||
$shareeId,
|
$shareeId,
|
||||||
$rows['shareType'],
|
$rows['shareType'],
|
||||||
$role,
|
$role,
|
||||||
$permission
|
$permission,
|
||||||
|
$expireDate
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user