Used expirationDateTime key for graph api (#9278)

This commit is contained in:
Prarup Gurung
2024-05-30 12:51:05 +05:45
committed by GitHub
parent ca79f2003c
commit a0a3447a00
5 changed files with 86 additions and 87 deletions
+10 -11
View File
@@ -1688,7 +1688,7 @@ class GraphHelper {
* @param array $shareTypes
* @param string|null $permissionsRole
* @param string|null $permissionsAction
* @param string|null $expireDate
* @param string|null $expirationDateTime
*
* @return array
* @throws \Exception
@@ -1698,7 +1698,7 @@ class GraphHelper {
array $shareTypes,
?string $permissionsRole,
?string $permissionsAction,
?string $expireDate
?string $expirationDateTime
): array {
$body = [];
@@ -1719,8 +1719,8 @@ class GraphHelper {
$body['@libre.graph.permissions.actions'] = ['libre.graph/driveItem/' . $permissionsAction];
}
if ($expireDate !== null) {
$body['expirationDateTime'] = $expireDate;
if ($expirationDateTime !== null) {
$body['expirationDateTime'] = $expirationDateTime;
}
return $body;
}
@@ -1736,7 +1736,7 @@ class GraphHelper {
* @param array $shareTypes
* @param string|null $permissionsRole
* @param string|null $permissionsAction
* @param string|null $expireDate
* @param string|null $expirationDateTime
*
* @return ResponseInterface
* @throws \JsonException
@@ -1753,11 +1753,10 @@ class GraphHelper {
array $shareTypes,
?string $permissionsRole,
?string $permissionsAction,
?string $expireDate
?string $expirationDateTime
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/invite");
$body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expireDate);
$body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expirationDateTime);
return HttpRequestHelper::post(
$url,
$xRequestId,
@@ -2115,7 +2114,7 @@ class GraphHelper {
* @param array $shareTypes
* @param string|null $permissionsRole
* @param string|null $permissionsAction
* @param string|null $expireDate
* @param string|null $expirationDateTime
*
* @return ResponseInterface
* @throws \Exception|GuzzleException
@@ -2130,10 +2129,10 @@ class GraphHelper {
array $shareTypes,
?string $permissionsRole,
?string $permissionsAction,
?string $expireDate
?string $expirationDateTime
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/root/invite");
$body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expireDate);
$body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expirationDateTime);
return HttpRequestHelper::post(
$url,
@@ -562,12 +562,12 @@ Feature: Send a sharing invitations
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 resource share invitation using the Graph API:
| resource | <resource> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
| expireDate | 2043-07-15T14:00:00.000Z |
| resource | <resource> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
| expirationDateTime | 2043-07-15T14:00:00.000Z |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -658,12 +658,12 @@ Feature: Send a sharing invitations
And 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 resource share invitation using the Graph API:
| resource | <resource> |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | <permissions-role> |
| expireDate | 2043-07-15T14:00:00.000Z |
| resource | <resource> |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | <permissions-role> |
| expirationDateTime | 2043-07-15T14:00:00.000Z |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -345,11 +345,11 @@ Feature: Share spaces
Scenario Outline: update the expiration date of a space in user share
Given user "Alice" has sent the following space share invitation:
| space | share space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
| expireDate | 2042-03-25T23:59:59.000Z |
| space | share space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
| expirationDateTime | 2042-03-25T23:59:59.000Z |
When user "Alice" updates the space "share space" with settings:
| shareWith | Brian |
| expireDate | 2044-01-01T23:59:59.999+01:00 |
@@ -367,11 +367,11 @@ Feature: Share spaces
Given group "sales" has been created
And the administrator has added a user "Brian" to the group "sales" using the Graph API
And user "Alice" has sent the following space share invitation:
| space | share space |
| sharee | sales |
| shareType | group |
| permissionsRole | <space-role> |
| expireDate | 2042-03-25T23:59:59.000Z |
| space | share space |
| sharee | sales |
| shareType | group |
| permissionsRole | <space-role> |
| expirationDateTime | 2042-03-25T23:59:59.000Z |
When user "Alice" updates the space "share space" with settings:
| shareWith | sales |
| shareType | 8 |
@@ -388,11 +388,11 @@ Feature: Share spaces
Scenario Outline: delete the expiration date of a space in user share
Given user "Alice" has sent the following space share invitation:
| space | share space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
| expireDate | 2042-03-25T23:59:59.000Z |
| space | share space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
| expirationDateTime | 2042-03-25T23:59:59.000Z |
When user "Alice" updates the space "share space" with settings:
| shareWith | Brian |
| expireDate | |
@@ -410,11 +410,11 @@ Feature: Share spaces
Given group "sales" has been created
And the administrator has added a user "Brian" to the group "sales" using the Graph API
And user "Alice" has sent the following space share invitation:
| space | share space |
| sharee | sales |
| shareType | group |
| permissionsRole | <space-role> |
| expireDate | 2042-03-25T23:59:59.000Z |
| space | share space |
| sharee | sales |
| shareType | group |
| permissionsRole | <space-role> |
| expirationDateTime | 2042-03-25T23:59:59.000Z |
When user "Alice" updates the space "share space" with settings:
| shareWith | sales |
| shareType | 8 |
@@ -431,11 +431,11 @@ Feature: Share spaces
Scenario Outline: check the end of expiration of a space in user share
Given user "Alice" has sent the following space share invitation:
| space | share space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
| expireDate | 2042-03-25T23:59:59.000Z |
| space | share space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
| expirationDateTime | 2042-03-25T23:59:59.000Z |
When user "Alice" expires the user share of space "share space" for user "Brian"
Then the HTTP status code should be "200"
And the user "Brian" should not have a space called "share space"
@@ -450,11 +450,11 @@ Feature: Share spaces
Given group "sales" has been created
And the administrator has added a user "Brian" to the group "sales" using the Graph API
And user "Alice" has sent the following space share invitation:
| space | share space |
| sharee | sales |
| shareType | group |
| permissionsRole | <space-role> |
| expireDate | 2042-03-25T23:59:59.000Z |
| space | share space |
| sharee | sales |
| shareType | group |
| permissionsRole | <space-role> |
| expirationDateTime | 2042-03-25T23:59:59.000Z |
When user "Alice" expires the group share of space "share space" for group "sales"
Then the HTTP status code should be "200"
And the user "Brian" should not have a space called "share space"
@@ -125,12 +125,12 @@ Feature: Share a file or folder that is inside a space
Scenario: user changes the expiration date
Given using SharingNG
And user "Alice" has sent the following resource share invitation:
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expireDate | 2042-01-01T23:59:59.000Z |
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expirationDateTime | 2042-01-01T23:59:59.000Z |
When user "Alice" changes the last share with settings:
| expireDate | 2044-01-01T23:59:59.999+01:00 |
| role | viewer |
@@ -142,12 +142,12 @@ Feature: Share a file or folder that is inside a space
Scenario: user deletes the expiration date
Given using SharingNG
And user "Alice" has sent the following resource share invitation:
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expireDate | 2042-01-01T23:59:59.000Z |
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expirationDateTime | 2042-01-01T23:59:59.000Z |
When user "Alice" changes the last share with settings:
| expireDate | |
| role | viewer |
@@ -160,12 +160,12 @@ Feature: Share a file or folder that is inside a space
Given using OCS API version "<ocs_api_version>"
And using SharingNG
And user "Alice" has sent the following resource share invitation:
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expireDate | 2042-01-01T23:59:59.000Z |
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expirationDateTime | 2042-01-01T23:59:59.000Z |
When user "Alice" changes the last share with settings:
| role | |
Then the HTTP status code should be "400"
@@ -174,12 +174,12 @@ Feature: Share a file or folder that is inside a space
Scenario: check the end of expiration date in user share
Given using SharingNG
And user "Alice" has sent the following resource share invitation:
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expireDate | 2042-01-01T23:59:59.000Z |
| resource | folder |
| space | share sub-item |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expirationDateTime | 2042-01-01T23:59:59.000Z |
When user "Alice" expires the last share of resource "folder" inside of the space "share sub-item"
Then the HTTP status code should be "200"
And as "Brian" folder "Shares/folder" should not exist
@@ -190,12 +190,12 @@ Feature: Share a file or folder that is inside a space
And using SharingNG
And the administrator has added a user "Brian" to the group "sales" using the Graph API
And user "Alice" has sent the following resource share invitation:
| resource | folder |
| space | share sub-item |
| sharee | sales |
| shareType | group |
| permissionsRole | Viewer |
| expireDate | 2042-01-01T23:59:59.000Z |
| resource | folder |
| space | share sub-item |
| sharee | sales |
| shareType | group |
| permissionsRole | Viewer |
| expirationDateTime | 2042-01-01T23:59:59.000Z |
When user "Alice" expires the last share of resource "folder" inside of the space "share sub-item"
Then the HTTP status code should be "200"
And as "Brian" folder "Shares/folder" should not exist
@@ -289,7 +289,7 @@ class SharingNgContext implements Context {
$permissionsRole = $rows['permissionsRole'] ?? null;
$permissionsAction = $rows['permissionsAction'] ?? null;
$expireDate = $rows["expireDate"] ?? null;
$expirationDateTime = $rows["expirationDateTime"] ?? null;
$response = GraphHelper::sendSharingInvitation(
$this->featureContext->getBaseUrl(),
@@ -302,7 +302,7 @@ class SharingNgContext implements Context {
$shareTypes,
$permissionsRole,
$permissionsAction,
$expireDate
$expirationDateTime
);
if ($response->getStatusCode() === 200) {
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
@@ -354,7 +354,7 @@ class SharingNgContext implements Context {
$permissionsRole = $rows['permissionsRole'] ?? null;
$permissionsAction = $rows['permissionsAction'] ?? null;
$expireDate = $rows["expireDate"] ?? null;
$expirationDateTime = $rows["expirationDateTime"] ?? null;
return GraphHelper::sendSharingInvitationForDrive(
$this->featureContext->getBaseUrl(),
@@ -366,7 +366,7 @@ class SharingNgContext implements Context {
$shareTypes,
$permissionsRole,
$permissionsAction,
$expireDate
$expirationDateTime
);
}