[full-ci] Enhance getSpaceByName: check local cache before Graph API calls (#1574)

* Enhance getSpaceByName: check local cache before Graph API calls

* Update API endpoint for regular user drives
This commit is contained in:
Viktor Scharf
2025-09-30 13:08:21 +02:00
committed by GitHub
parent f4eaa8bd5b
commit 25246782b2
18 changed files with 127 additions and 114 deletions
@@ -71,11 +71,7 @@ class SharingNgContext implements Context {
$bodyRows = $body->getRowsHash();
$resource = $bodyRows['resource'] ?? "";
if ($bodyRows['space'] === 'Personal' || $bodyRows['space'] === 'Shares') {
$space = $this->spacesContext->getSpaceByName($user, $bodyRows['space']);
} else {
$space = $this->spacesContext->getCreatedSpace($bodyRows['space']);
}
$space = $this->spacesContext->getSpaceByName($user, $bodyRows['space']);
$spaceId = $space['id'];
if ($resource === '' && !\in_array($bodyRows['space'], ['Personal', 'Shares'])) {
@@ -299,11 +295,7 @@ class SharingNgContext implements Context {
?string $fileId = null,
bool $federatedShare = false
): ResponseInterface {
if ($shareInfo['space'] === 'Personal' || $shareInfo['space'] === 'Shares') {
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
} else {
$space = $this->spacesContext->getCreatedSpace($shareInfo['space']);
}
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
$spaceId = $space['id'];
// $fileId is used for trying to share deleted files
@@ -394,11 +386,7 @@ class SharingNgContext implements Context {
): ResponseInterface {
$shareeIds = [];
$rows = $table->getRowsHash();
if ($rows['space'] === 'Personal' || $rows['space'] === 'Shares') {
$space = $this->spacesContext->getSpaceByName($user, $rows['space']);
} else {
$space = $this->spacesContext->getCreatedSpace($rows['space']);
}
$space = $this->spacesContext->getSpaceByName($user, $rows['space']);
$spaceId = $space['id'];
$sharees = array_map('trim', explode(',', $rows['sharee']));
@@ -685,11 +673,7 @@ class SharingNgContext implements Context {
*/
public function updateResourceShare(string $user, TableNode $body, string $permissionID): ResponseInterface {
$bodyRows = $body->getRowsHash();
if ($bodyRows['space'] === 'Personal' || $bodyRows['space'] === 'Shares') {
$space = $this->spacesContext->getSpaceByName($user, $bodyRows['space']);
} else {
$space = $this->spacesContext->getCreatedSpace($bodyRows['space']);
}
$space = $this->spacesContext->getSpaceByName($user, $bodyRows['space']);
$spaceId = $space["id"];
// for updating role of project space shared, we do not need to provide resource
$resource = $bodyRows['resource'] ?? '';
+53 -25
View File
@@ -51,7 +51,7 @@ class SpacesContext implements Context {
/**
* key is space name and value is the username that created the space
*/
private array $createdSpaces;
private array $createdSpaces = [];
private string $ocsApiUrl = '/ocs/v2.php/apps/files_sharing/api/v1/shares';
/**
@@ -94,6 +94,7 @@ class SpacesContext implements Context {
$response = $this->featureContext->getJsonDecodedResponseBodyContent($response);
$spaceName = $response->name;
$this->createdSpaces[$spaceName] = [];
$this->createdSpaces[$spaceName]['name'] = $response->name;
$this->createdSpaces[$spaceName]['id'] = $response->id;
$this->createdSpaces[$spaceName]['spaceCreator'] = $spaceCreator;
$this->createdSpaces[$spaceName]['fileId'] = $response->id . '!' . $response->owner->user->id;
@@ -102,10 +103,10 @@ class SpacesContext implements Context {
/**
* @param string $spaceName
*
* @return array
* @return array|null
*/
public function getCreatedSpace(string $spaceName): array {
return $this->createdSpaces[$spaceName];
public function getCreatedSpace(string $spaceName): ?array {
return $this->createdSpaces[$spaceName] ?? null;
}
private array $availableSpaces = [];
@@ -181,9 +182,19 @@ class SpacesContext implements Context {
* @throws GuzzleException
*/
public function getSpaceByName(string $user, string $spaceName): array {
if ($spaceName === "Personal") {
$spaceName = $this->featureContext->getUserDisplayName($user);
// First, try to find the space in locally saved (previously created) spaces — no API call
$space = $this->getCreatedSpace($spaceName);
if ($space !== null) {
return $space;
}
// If it's a personal space and not found in the getCreatedSpace() — fetch via Graph API
// GET /graph/v1.0/users/{userId}?$select=&$expand=drive
if ($spaceName === "Personal" && $user !== 'admin') {
return $this->getPersonalSpace($user);
}
// If the space is not found in the getCreatedSpace() and it's not personal — call API to list available spaces
// Admin: GET /graph/v1.0/drives
// Regular user: GET /graph/v1.0/me/drives
if (strtolower($user) === 'admin') {
$listSpacesFn = 'listAllAvailableSpaces';
} else {
@@ -221,7 +232,7 @@ class SpacesContext implements Context {
/**
* @param string $user
*
* @return string
* @return array
* @throws GuzzleException
* @throws JsonException
*/
@@ -699,7 +710,6 @@ class SpacesContext implements Context {
$space = $this->getSpaceByName(($ownerUser !== "") ? $ownerUser : $user, $spaceName);
Assert::assertIsArray($space);
Assert::assertNotEmpty($space["id"]);
Assert::assertNotEmpty($space["root"]["webDavUrl"]);
$this->featureContext->setResponse(
GraphHelper::getSingleSpace(
$this->featureContext->getBaseUrl(),
@@ -734,17 +744,9 @@ class SpacesContext implements Context {
): void {
$space = ["name" => $spaceName, "driveType" => $spaceType, "quota" => ["total" => $quota]];
$body = json_encode($space);
$response = GraphHelper::createSpace(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$body,
$this->featureContext->getStepLineRef()
$this->featureContext->setResponse(
$this->createSpace($user, $space, $body)
);
$this->featureContext->setResponse($response);
if ($response->getStatusCode() === 201) {
$this->addCreatedSpace($user, $response);
}
}
/**
@@ -1671,7 +1673,29 @@ class SpacesContext implements Context {
}
/**
* @Given /^user "([^"]*)" has changed the quota of the personal space of user "([^"]*)" space to "([^"]*)"$/
* @When user :user changes the quota of the personal space of user :targetUser to :newQuota using the Graph API
*
* @param string $user
* @param string $targetUser
* @param int $newQuota
*
* @return void
* @throws GuzzleException
* @throws Exception
*/
public function updatePersonalSpaceQuota(
string $user,
string $targetUser,
int $newQuota
): void {
$bodyData = ["quota" => ["total" => $newQuota]];
$this->featureContext->setResponse(
$this->updatePersonalSpace($user, $targetUser, $bodyData)
);
}
/**
* @Given user :user has changed the quota of the personal space of user :targetUser to :newQuota
*
* @param string $user
* @param string $targetUser
@@ -1806,7 +1830,6 @@ class SpacesContext implements Context {
): void {
$space = ["name" => $spaceName, "driveType" => $spaceType, "quota" => ["total" => $quota]];
$response = $this->createSpace($user, $space);
$this->addCreatedSpace($user, $response);
$this->featureContext->theHTTPStatusCodeShouldBe(
201,
"Expected response status code should be 201 (Created)",
@@ -1831,7 +1854,6 @@ class SpacesContext implements Context {
): void {
$space = ["name" => $spaceName];
$response = $this->createSpace($user, $space);
$this->addCreatedSpace($user, $response);
$this->featureContext->theHTTPStatusCodeShouldBe(
201,
"Expected response status code should be 201 (Created)",
@@ -1841,7 +1863,8 @@ class SpacesContext implements Context {
/**
* @param string $user
* @param string $space
* @param array $space
* @param string $body
*
* @return ResponseInterface
* @throws GuzzleException
@@ -1849,16 +1872,21 @@ class SpacesContext implements Context {
*/
public function createSpace(
string $user,
array $space
array $space,
string $body = ''
): ResponseInterface {
$body = json_encode($space, JSON_THROW_ON_ERROR);
return GraphHelper::createSpace(
$body = $body !== '' ? $body : json_encode($space, JSON_THROW_ON_ERROR);
$response = GraphHelper::createSpace(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$body,
$this->featureContext->getStepLineRef()
);
if ($response->getStatusCode() === 201) {
$this->addCreatedSpace($user, $response);
}
return $response;
}
/**
@@ -153,8 +153,8 @@
- [apiSharingNgLinkSharePermission/updateLinkShare.feature:282](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNgLinkSharePermission/updateLinkShare.feature#L282)
- [apiSharingNgLinkShareRoot/updateLinkShare.feature:10](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNgLinkShareRoot/updateLinkShare.feature#L10)
- [apiSharingNgLinkShareRoot/updateLinkShare.feature:42](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNgLinkShareRoot/updateLinkShare.feature#L42)
- [coreApiSharePublicLink1/changingPublicLinkShare.feature:219](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature#L219)
- [coreApiSharePublicLink1/changingPublicLinkShare.feature:220](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature#L220)
- [coreApiSharePublicLink1/changingPublicLinkShare.feature:221](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature#L221)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:59](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L59)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:60](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L60)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:88](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L88)
@@ -85,7 +85,7 @@ Feature: CORS headers
@issue-8231
Scenario Outline: CORS headers should be returned when setting CORS domain sending origin header in the Webdav api
Given using <dav-path-version> DAV path
When user "Alice" sends PROPFIND request to space "Alice Hansen" with headers using the WebDAV API
When user "Alice" sends PROPFIND request to space "Personal" with headers using the WebDAV API
| header | value |
| Origin | https://aphno.badal |
Then the HTTP status code should be "207"
@@ -411,7 +411,7 @@ Feature: user GDPR (General Data Protection Regulation) report
Scenario: generate a GDPR report after the admin updates the quota of personal space
Given user "Admin" has changed the quota of the personal space of user "Alice" space to "10000"
Given user "Admin" has changed the quota of the personal space of user "Alice" to "10000"
When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API
And user "Alice" downloads the content of GDPR report ".personal_data_export.json"
Then the HTTP status code of responses on each endpoint should be "202, 200" respectively
@@ -11,11 +11,11 @@ Feature: lock files
Scenario Outline: lock a file
Given using <dav-path-version> DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
When user "Alice" locks file "textfile.txt" using the WebDAV API setting the following properties
| lockscope | exclusive |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -32,12 +32,12 @@ Feature: lock files
Scenario Outline: lock a file with a timeout
Given using <dav-path-version> DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
When user "Alice" locks file "textfile.txt" using the WebDAV API setting the following properties
| lockscope | exclusive |
| timeout | Second-5000 |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -54,13 +54,13 @@ Feature: lock files
Scenario: lock a file using file-id
Given using spaces DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
When user "Alice" locks file "textfile.txt" using file-id "<<FILEID>>" using the WebDAV API setting the following properties
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -72,7 +72,7 @@ Feature: lock files
Scenario Outline: user cannot lock file twice
Given using <dav-path-version> DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And user "Alice" has locked file "textfile.txt" setting the following properties
| lockscope | exclusive |
When user "Alice" tries to lock file "textfile.txt" using the WebDAV API setting the following properties
@@ -163,7 +163,7 @@ Feature: lock files
@issue-7599
Scenario Outline: lock a file in the shares
Given using <dav-path-version> DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
| space | Personal |
@@ -174,7 +174,7 @@ Feature: lock files
When user "Brian" locks file "/Shares/textfile.txt" using the WebDAV API setting the following properties
| lockscope | exclusive |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -189,7 +189,7 @@ Feature: lock files
Scenario: lock a file in the shares using file-id
Given using spaces DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
@@ -202,7 +202,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -213,7 +213,7 @@ Feature: lock files
Scenario Outline: viewer cannot lock a file in the shares using file-id
Given using spaces DAV path
And the administrator has enabled the permissions role "Secure Viewer"
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
@@ -233,7 +233,7 @@ Feature: lock files
Scenario: sharee cannot lock a resource exclusively locked by a sharer
Given using spaces DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
@@ -248,7 +248,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "423"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -258,7 +258,7 @@ Feature: lock files
Scenario: sharer cannot lock a resource exclusively locked by a sharee
Given using spaces DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
@@ -273,7 +273,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "423"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "textfile.txt" with these key and value pairs:
| key | value |
@@ -249,7 +249,7 @@ Feature: unlock locked items
Scenario: unlock a file using file-id
Given using spaces DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
And user "Alice" has locked file "textfile.txt" using file-id "<<FILEID>>" setting the following properties
| lockscope | exclusive |
@@ -278,7 +278,7 @@ Feature: unlock locked items
Scenario: unlock a file in the shares using file-id
Given user "Brian" has been created with default attributes
And using spaces DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "textfile.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
@@ -282,8 +282,8 @@ Feature: Search
@issue-enterprise-6000 @issue-7028 @issue-7092 @issue-10329
Scenario Outline: sharee cannot find resources that are not shared
Given using <dav-path-version> DAV path
And user "Alice" has created a folder "foo/sharedToBrian" in space "Alice Hansen"
And user "Alice" has created a folder "sharedToCarol" in space "Alice Hansen"
And user "Alice" has created a folder "foo/sharedToBrian" in space "Personal"
And user "Alice" has created a folder "sharedToCarol" in space "Personal"
And user "Alice" has sent the following resource share invitation:
| resource | foo |
| space | Personal |
@@ -516,8 +516,8 @@ Feature: Change data of space
Scenario Outline: user can't upload resource greater than set quota
Given the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
And user "Admin" has changed the quota of the personal space of user "Alice" space to "15"
When user "Alice" uploads a file inside space "Alice Hansen" with content "file is more than 15 bytes" to "file.txt" using the WebDAV API
And user "Admin" has changed the quota of the personal space of user "Alice" to "15"
When user "Alice" uploads a file inside space "Personal" with content "file is more than 15 bytes" to "file.txt" using the WebDAV API
Then the HTTP status code should be "507"
And for user "Alice" the space "Personal" should not contain these entries:
| file.txt |
@@ -530,11 +530,11 @@ Feature: Change data of space
Scenario Outline: admin user set own quota of a personal space via the Graph API and upload resource
When user "Admin" changes the quota of the "Admin" space to "<quota-value>"
When user "Admin" changes the quota of the personal space of user "Alice" to "<quota-value>" using the Graph API
Then the HTTP status code should be "200"
When user "Admin" uploads a file inside space "Admin" with content "file is more than 15 bytes" to "file.txt" using the WebDAV API
When user "Alice" uploads a file inside space "Personal" with content "file is more than 15 bytes" to "file.txt" using the WebDAV API
Then the HTTP status code should be <http-status-code>
And for user "Admin" the space "Personal" should contain these entries:
And for user "Alice" the space "Personal" should contain these entries:
| file.txt |
Examples:
| quota-value | http-status-code |
@@ -544,9 +544,9 @@ Feature: Change data of space
Scenario Outline: admin user set an user personal space quota of via the Graph API and upload resource
When user "Admin" changes the quota of the "Brian Murphy" space to "<quota-value>"
When user "Admin" changes the quota of the personal space of user "Brian" to "<quota-value>" using the Graph API
Then the HTTP status code should be "200"
When user "Brian" uploads a file inside space "Brian Murphy" with content "file is more than 15 bytes" to "file.txt" using the WebDAV API
When user "Brian" uploads a file inside space "Personal" with content "file is more than 15 bytes" to "file.txt" using the WebDAV API
Then the HTTP status code should be <http-status-code>
And for user "Brian" the space "Personal" should contain these entries:
| file.txt |
@@ -105,7 +105,7 @@ Feature: State of the quota
Scenario Outline: check the relative amount of quota of personal space
Given user "Admin" has changed the quota of the personal space of user "Alice" space to "10000"
Given user "Admin" has changed the quota of the personal space of user "Alice" to "10000"
And user "Alice" has uploaded file "<file-upload>" to "/demo.txt"
When the user "Alice" requests these endpoints with "GET" with basic auth
| endpoint |
@@ -138,7 +138,7 @@ Feature: State of the quota
Scenario: user can restore a file version even if there is not enough quota to do so
Given user "Admin" has changed the quota of the personal space of user "Alice" space to "30"
Given user "Admin" has changed the quota of the personal space of user "Alice" to "30"
And user "Alice" has uploaded file with content "file is less than 30 bytes" to "/file.txt"
And user "Alice" has uploaded file with content "reduceContent" to "/file.txt"
And user "Alice" has uploaded file with content "some content" to "newFile.txt"
@@ -13,7 +13,7 @@ Feature: Set quota
Scenario Outline: admin sets personal space quota of user with different role
Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API
And the administrator has assigned the role "<user-role>" to user "Brian" using the Graph API
When user "Alice" changes the quota of the "Brian Murphy" space to "100" owned by user "Brian"
When user "Alice" changes the quota of the personal space of user "Brian" to "100" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -49,7 +49,7 @@ Feature: Set quota
Scenario Outline: non-admin user tries to set the personal space quota of other users
Given the administrator has assigned the role "<user-role-2>" to user "Alice" using the Graph API
And the administrator has assigned the role "<user-role>" to user "Brian" using the Graph API
When user "Alice" changes the quota of the "Brian Murphy" space to "100" owned by user "Brian"
When user "Alice" changes the quota of the personal space of user "Brian" to "100" using the Graph API
Then the HTTP status code should be "403"
Examples:
| user-role-2 | user-role |
@@ -129,8 +129,7 @@ Feature: Set quota
Scenario: admin user can set their own personal space quota
Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API
When user "Alice" changes the quota of the "Alice Hansen" space to "100" owned by user "Alice"
When user "Admin" changes the quota of the personal space of user "Alice" to "100" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -159,7 +158,7 @@ Feature: Set quota
Scenario Outline: non-admin user tries to set their own personal space quota
Given the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
When user "Alice" changes the quota of the "Alice Hansen" space to "100" owned by user "Alice"
When user "Alice" changes the quota of the personal space of user "Alice" to "100" using the Graph API
Then the HTTP status code should be "403"
Examples:
| user-role |
@@ -53,22 +53,22 @@ Feature: Tag
Scenario: user creates tags for resources in the personal space
Given user "Alice" has created a folder "folderMain" in space "Alice Hansen"
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "file.txt"
When user "Alice" creates the following tags for folder "folderMain" of space "Alice Hansen":
Given user "Alice" has created a folder "folderMain" in space "Personal"
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "file.txt"
When user "Alice" creates the following tags for folder "folderMain" of space "Personal":
| my tag |
| important |
Then the HTTP status code should be "200"
When user "Alice" creates the following tags for file "file.txt" of space "Alice Hansen":
When user "Alice" creates the following tags for file "file.txt" of space "Personal":
| fileTag |
| tag with symbol @^$#^%$@%!_+) |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "folderMain" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "folderMain" with these key and value pairs:
| key | value |
| oc:tags | my tag,important |
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "file.txt" with depth "0" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Personal" to the resource "file.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Alice" the PROPFIND response should contain a resource "file.txt" with these key and value pairs:
| key | value |
@@ -34,9 +34,9 @@ Feature: upload resources using TUS protocol
Scenario: upload the same file after renaming the first one
Given user "Alice" has uploaded a file with content "uploaded content" to "/upload.txt" via TUS inside of the space "Alice Hansen"
And user "Alice" has moved file "upload.txt" to "test.txt" in space "Alice Hansen"
And user "Alice" has moved file "upload.txt" to "test.txt" in space "Personal"
When user "Alice" uploads a file with content "uploaded content" to "/upload.txt" via TUS inside of the space "Alice Hansen" using the WebDAV API
Then for user "Alice" the space "Alice Hansen" should contain these entries:
Then for user "Alice" the space "Personal" should contain these entries:
| test.txt |
| upload.txt |
@@ -331,7 +331,7 @@ Feature: sharing
| shareType | user |
| permissionsRole | Editor |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
@@ -348,7 +348,7 @@ Feature: sharing
| shareType | group |
| permissionsRole | Editor |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
@@ -363,7 +363,7 @@ Feature: sharing
| shareType | user |
| permissionsRole | Uploader |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
@@ -380,7 +380,7 @@ Feature: sharing
| shareType | group |
| permissionsRole | Uploader |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "10"
And user "Admin" has changed the quota of the personal space of user "Alice" to "10"
When user "Brian" uploads a file inside space "Shares" with content "new descriptionfgshsywhhh" to "/FOLDER/textfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
@@ -167,7 +167,7 @@ Feature: sharing
Scenario Outline: check quota of owners parent directory of a shared file
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes
And user "Admin" has changed the quota of the personal space of user "Brian" space to "0"
And user "Admin" has changed the quota of the personal space of user "Brian" to "0"
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/myfile.txt"
And user "Alice" has sent the following resource share invitation:
| resource | myfile.txt |
@@ -204,7 +204,7 @@ Feature: sharing
| shareType | user |
| permissionsRole | Editor |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/myfile.txt" should not exist
@@ -228,7 +228,7 @@ Feature: sharing
| shareType | group |
| permissionsRole | Editor |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/myfile.txt" should not exist
@@ -250,7 +250,7 @@ Feature: sharing
| shareType | user |
| permissionsRole | Uploader |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/myfile.txt" should not exist
@@ -274,7 +274,7 @@ Feature: sharing
| shareType | group |
| permissionsRole | Uploader |
And user "Brian" has a share "FOLDER" synced
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/myfile.txt" should not exist
@@ -198,16 +198,17 @@ Feature: changing a public link share
@issue-9724 @issue-10331
Scenario Outline: administrator removes password of a read-only public link
Given using OCS API version "<ocs-api-version>"
Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API
And using OCS API version "<ocs-api-version>"
And admin has created folder "/PARENT"
And user "Admin" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt"
And using SharingNG
And user "Admin" has created the following resource link share:
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | view |
| password | %public% |
When user "Admin" updates the last public link share using the sharing API with
When user "Alice" updates the last public link share using the sharing API with
| path | /PARENT |
| permissions | read |
| password | |
@@ -221,15 +222,16 @@ Feature: changing a public link share
Scenario Outline: administrator tries to remove password of a public link share (change/create permission)
Given using OCS API version "<ocs-api-version>"
Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API
And using OCS API version "<ocs-api-version>"
And admin has created folder "/PARENT"
And using SharingNG
And user "Admin" has created the following resource link share:
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | <permissions-role> |
| password | %public% |
When user "admin" updates the last public link share using the sharing API with
When user "Alice" updates the last public link share using the sharing API with
| path | /PARENT |
| permissions | <permissions> |
| password | |
@@ -86,7 +86,7 @@ Feature: upload to a public link share
| space | Personal |
| permissionsRole | edit |
| password | %public% |
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When the public uploads file "test.txt" with password "%public%" and content "test2" using the public WebDAV API
Then the HTTP status code should be "507"
@@ -98,7 +98,7 @@ Feature: upload to a public link share
| space | Personal |
| permissionsRole | createOnly |
| password | %public% |
And user "Admin" has changed the quota of the personal space of user "Alice" space to "1"
And user "Admin" has changed the quota of the personal space of user "Alice" to "1"
When the public uploads file "test.txt" with password "%public%" and content "test2" using the public WebDAV API
Then the HTTP status code should be "507"
@@ -11,7 +11,7 @@ Feature: get quota
Scenario Outline: retrieving folder quota when no quota is set
Given using <dav-path-version> DAV path
When user "Admin" changes the quota of the "Alice Hansen" space to "0"
When user "Admin" changes the quota of the personal space of user "Alice" to "0" using the Graph API
Then the HTTP status code should be "200"
And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "0"
Examples:
@@ -23,7 +23,7 @@ Feature: get quota
@smokeTest
Scenario Outline: retrieving folder quota when quota is set
Given using <dav-path-version> DAV path
When user "Admin" changes the quota of the "Alice Hansen" space to "10000"
When user "Admin" changes the quota of the personal space of user "Alice" to "10000" using the Graph API
Then the HTTP status code should be "200"
And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "10000"
Examples:
@@ -36,8 +36,8 @@ Feature: get quota
Scenario Outline: retrieving folder quota of shared folder with quota when no quota is set for recipient
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes
And user "Admin" has changed the quota of the personal space of user "Alice" space to "0"
And user "Admin" has changed the quota of the personal space of user "Brian" space to "10000"
And user "Admin" has changed the quota of the personal space of user "Alice" to "0"
And user "Admin" has changed the quota of the personal space of user "Brian" to "10000"
And user "Brian" has created folder "/testquota"
And user "Brian" has uploaded file "/testquota/Brian.txt" of size 1000 bytes
And user "Brian" has sent the following resource share invitation:
@@ -61,7 +61,7 @@ Feature: get quota
@issue-8197
Scenario Outline: retrieving folder quota when quota is set and a file was uploaded
Given using <dav-path-version> DAV path
And user "Admin" has changed the quota of the personal space of user "Alice" space to "10000"
And user "Admin" has changed the quota of the personal space of user "Alice" to "10000"
And user "Alice" has uploaded file "/prueba.txt" of size 1000 bytes
When user "Alice" gets the following properties of folder "/" using the WebDAV API
| propertyName |
@@ -78,7 +78,7 @@ Feature: get quota
Scenario Outline: retrieving folder quota when quota is set and a file was received
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes
And user "Admin" has changed the quota of the personal space of user "Brian" space to "10000"
And user "Admin" has changed the quota of the personal space of user "Brian" to "10000"
And user "Alice" has uploaded file "/Alice.txt" of size 93 bytes
And user "Alice" has sent the following resource share invitation:
| resource | Alice.txt |