check email in the search sharee request (#8861)

This commit is contained in:
Viktor Scharf
2024-04-17 11:42:09 +02:00
committed by GitHub
parent 0972b7cc12
commit b51ba47e01
6 changed files with 1087 additions and 1001 deletions
+1
View File
@@ -78,6 +78,7 @@ default:
contexts:
- FeatureContext: *common_feature_context_params
- ShareesContext:
- OcisConfigContext:
coreApiShareManagementToShares:
paths:
File diff suppressed because it is too large Load Diff
@@ -255,7 +255,8 @@ Feature: edit/search user including email
| User Light |
Scenario: non-admin user searches other users by display name
Scenario Outline: non-admin user searches other users by display name
Given the administrator has assigned the role "<user-role>" to user "Brian" using the Graph API
When user "Brian" searches for user "ali" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
@@ -296,6 +297,11 @@ Feature: edit/search user including email
}
}
"""
Examples:
| user-role |
| Space Admin |
| User |
| User Light |
@issue-7990
Scenario: non-admin user searches other users by e-mail
@@ -460,3 +466,16 @@ Feature: edit/search user including email
}
}
"""
Scenario Outline: search other users when OCIS_SHOW_USER_EMAIL_IN_RESULTS config is disabled
Given the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "false"
And the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
When user "Alice" searches for user "Brian" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the search response should not contain user email
Examples:
| user-role |
| Space Admin |
| User |
| User Light |
@@ -2624,4 +2624,27 @@ class GraphContext implements Context {
$this->featureContext->getJSONSchema($schemaString)
);
}
/**
* @Then the JSON data of the search response should not contain user(s) email
*
* @return void
* @throws Exception
*/
public function theJsonDataResponseShouldNotContainUserEmail(): void {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->value;
$mailValueExist = false;
$email = "";
foreach ($responseBody as $value) {
if (isset($value->mail)) {
$mailValueExist = true;
$email = $value->mail;
break;
}
}
Assert::assertFalse(
$mailValueExist,
"Response contains email '$email' but should not."
);
}
}
@@ -90,7 +90,7 @@ class ShareesContext implements Context {
* @throws Exception
*/
public function theShareesReturnedShouldBe(string $shareeType, TableNode $shareesList):void {
$this->featureContext->verifyTableNodeColumnsCount($shareesList, 3);
$this->featureContext->verifyTableNodeColumnsCount($shareesList, 4);
$sharees = $shareesList->getRows();
$respondedArray = $this->getArrayOfShareesResponded(
$this->featureContext->getResponse(),
@@ -186,14 +186,16 @@ class ShareesContext implements Context {
$sharees[] = [
$innerItem['label'],
$innerItem['value']['shareType'],
$innerItem['value']['shareWith']
$innerItem['value']['shareWith'],
$innerItem['value']['shareWithAdditionalInfo']
];
}
} else {
$sharees[] = [
$element['label'],
$element['value']['shareType'],
$element['value']['shareWith']
$element['value']['shareWith'],
$element['value']['shareWithAdditionalInfo']
];
}
}
@@ -22,11 +22,11 @@ Feature: search sharees
And the HTTP status code should be "200"
And the "exact users" sharees returned should be empty
And the "users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee One | 0 | sharee1 | sharee1 |
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be
| ShareeGroup | 1 | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 |
| ShareeGroup | 1 | ShareeGroup | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 | ShareeGroup2 |
And the "exact remotes" sharees returned should be empty
And the "remotes" sharees returned should be empty
Examples:
@@ -44,11 +44,11 @@ Feature: search sharees
And the HTTP status code should be "200"
And the "exact users" sharees returned should be empty
And the "users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee One | 0 | sharee1 | sharee1 |
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be
| ShareeGroup | 1 | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 |
| ShareeGroup | 1 | ShareeGroup | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 | ShareeGroup2 |
And the "exact remotes" sharees returned should be empty
And the "remotes" sharees returned should be empty
Examples:
@@ -67,11 +67,11 @@ Feature: search sharees
And the HTTP status code should be "200"
And the "exact users" sharees returned should be empty
And the "users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee One | 0 | sharee1 | sharee1 |
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be
| ShareeGroup | 1 | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 |
| ShareeGroup | 1 | ShareeGroup | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 | ShareeGroup2 |
And the "exact remotes" sharees returned should be empty
And the "remotes" sharees returned should be empty
Examples:
@@ -88,7 +88,7 @@ Feature: search sharees
Then the OCS status code should be "<ocs-status-code>"
And the HTTP status code should be "200"
And the "exact users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee One | 0 | sharee1 | sharee1 |
And the "users" sharees returned should be empty
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be empty
@@ -108,7 +108,7 @@ Feature: search sharees
Then the OCS status code should be "<ocs-status-code>"
And the HTTP status code should be "200"
And the "exact users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee One | 0 | sharee1 | sharee1 |
And the "users" sharees returned should be empty
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be empty
@@ -130,7 +130,7 @@ Feature: search sharees
And the "exact users" sharees returned should be empty
And the "users" sharees returned should be empty
And the "exact groups" sharees returned should be
| ShareeGroup2 | 1 | ShareeGroup2 |
| ShareeGroup2 | 1 | ShareeGroup2 | ShareeGroup2 |
And the "groups" sharees returned should be empty
And the "exact remotes" sharees returned should be empty
And the "remotes" sharees returned should be empty
@@ -148,7 +148,7 @@ Feature: search sharees
Then the OCS status code should be "<ocs-status-code>"
And the HTTP status code should be "200"
And the "exact users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee One | 0 | sharee1 | sharee1 |
And the "users" sharees returned should be empty
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be empty
@@ -173,7 +173,7 @@ Feature: search sharees
And the HTTP status code should be "200"
And the "exact users" sharees returned should be empty
And the "users" sharees returned should be
| Another | 0 | another |
| Another | 0 | another | another |
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be empty
And the "exact remotes" sharees returned should be empty
@@ -194,15 +194,49 @@ Feature: search sharees
And the HTTP status code should be "200"
And the "exact users" sharees returned should be empty
And the "users" sharees returned should be
| Sharee One | 0 | sharee1 |
| Sharee Two | 0 | sharee2 |
| Sharee One | 0 | sharee1 | sharee1 |
| Sharee Two | 0 | sharee2 | sharee2 |
And the "exact groups" sharees returned should be empty
And the "groups" sharees returned should be
| ShareeGroup | 1 | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 |
| ShareeGroup | 1 | ShareeGroup | ShareeGroup |
| ShareeGroup2 | 1 | ShareeGroup2 | ShareeGroup2 |
And the "exact remotes" sharees returned should be empty
And the "remotes" sharees returned should be empty
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |
@env-config
Scenario Outline: search other users when OCIS_SHOW_USER_EMAIL_IN_RESULTS config is enabled
Given user "Brian" has been created with default attributes and without skeleton files
And the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "true"
And using OCS API version "<ocs-api-version>"
When user "Alice" gets the sharees using the sharing API with parameters
| search | Brian |
| itemType | file |
Then the OCS status code should be "<ocs-status-code>"
And the HTTP status code should be "200"
And the "exact users" sharees returned should be
| Brian Murphy | 0 | Brian | brian@example.org |
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |
@env-config
Scenario Outline: search other users when OCIS_SHOW_USER_EMAIL_IN_RESULTS config is disabled
Given user "Brian" has been created with default attributes and without skeleton files
And the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "false"
And using OCS API version "<ocs-api-version>"
When user "Alice" gets the sharees using the sharing API with parameters
| search | Brian |
| itemType | file |
Then the OCS status code should be "<ocs-status-code>"
And the HTTP status code should be "200"
And the "exact users" sharees returned should be
| Brian Murphy | 0 | Brian | Brian |
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |