Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(provisioning_api): Correct limit for editUser
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Feb 7, 2025
commit 422655bf1e5baace2cd715ea1335b752944d080f
2 changes: 1 addition & 1 deletion apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public function editUserMultiValue(
*/
#[PasswordConfirmationRequired]
#[NoAdminRequired]
#[UserRateLimit(limit: 50, period: 60)]
#[UserRateLimit(limit: 50, period: 600)]
public function editUser(string $userId, string $key, string $value): DataResponse {
$currentLoggedInUser = $this->userSession->getUser();

Expand Down
2 changes: 2 additions & 0 deletions apps/settings/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\Attribute\UserRateLimit;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
Expand Down Expand Up @@ -312,6 +313,7 @@ protected function canAdminChangeUserPasswords(): bool {
*/
#[NoAdminRequired]
#[PasswordConfirmationRequired]
#[UserRateLimit(limit: 5, period: 60)]
public function setUserSettings(?string $avatarScope = null,
?string $displayname = null,
?string $displaynameScope = null,
Expand Down
6 changes: 5 additions & 1 deletion build/integration/features/bootstrap/BasicStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ public function sendingTo($verb, $url) {
* @return string
*/
public function getOCSResponse($response) {
return simplexml_load_string($response->getBody())->meta[0]->statuscode;
$body = simplexml_load_string((string)$response->getBody());
if ($body === false) {
throw new \RuntimeException('Could not parse OCS response, body is not valid XML');
}
return $body->meta[0]->statuscode;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions build/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
* Features context.
*/
class FeatureContext implements Context, SnippetAcceptingContext {
use AppConfiguration;
use ContactsMenu;
use ExternalStorage;
use Search;
use WebDav;
use Trashbin;

protected function resetAppConfigs(): void {
$this->deleteServerConfig('bruteForce', 'whitelist_0');
$this->deleteServerConfig('bruteForce', 'whitelist_1');
$this->deleteServerConfig('bruteforcesettings', 'apply_allowlist_to_ratelimit');
}
}
21 changes: 14 additions & 7 deletions build/integration/features/provisioning-v1.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Feature: provisioning
Background:
Given using api version "1"
Given parameter "whitelist_0" of app "bruteForce" is set to "127.0.0.1"
Given parameter "whitelist_1" of app "bruteForce" is set to "::1"
Given parameter "apply_allowlist_to_ratelimit" of app "bruteforcesettings" is set to "true"

Scenario: Getting an not existing user
Given As an "admin"
Expand Down Expand Up @@ -570,7 +573,7 @@ Feature: provisioning
And group "new-group" does not exist

Scenario: Delete a group with special characters
Given As an "admin"
Given As an "admin"
And group "España" exists
When sending "DELETE" to "/cloud/groups/España"
Then the OCS status code should be "100"
Expand Down Expand Up @@ -600,6 +603,7 @@ Feature: provisioning
| settings |
| sharebymail |
| systemtags |
| testing |
| theming |
| twofactor_backupcodes |
| updatenotification |
Expand All @@ -625,6 +629,7 @@ Feature: provisioning
And the HTTP status code should be "200"

Scenario: enable an app
Given invoking occ with "app:disable testing"
Given As an "admin"
And app "testing" is disabled
When sending "POST" to "/cloud/apps/testing"
Expand All @@ -638,13 +643,15 @@ Feature: provisioning
Then the OCS status code should be "998"
And the HTTP status code should be "200"

Scenario: disable an app
Given As an "admin"
And app "testing" is enabled
When sending "DELETE" to "/cloud/apps/testing"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
Scenario: disable an app
Given invoking occ with "app:enable testing"
Given As an "admin"
And app "testing" is enabled
When sending "DELETE" to "/cloud/apps/testing"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And app "testing" is disabled
Given invoking occ with "app:enable testing"

Scenario: disable an user
Given As an "admin"
Expand Down