Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions build/integration/features/provisioning-v1.feature
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ Feature: provisioning
| timezoneOffset | 0 |
| pronouns | NULL |

Scenario: Edit a user with mixed case emails
Given As an "admin"
And user "brand-new-user" exists
And sending "PUT" to "/cloud/users/brand-new-user" with
| key | email |
| value | [email protected] |
And the OCS status code should be "100"
And the HTTP status code should be "200"
Then user "brand-new-user" has
| id | brand-new-user |
| email | [email protected] |

Scenario: Edit a user account properties scopes
Given user "brand-new-user" exists
And As an "brand-new-user"
Expand Down
16 changes: 16 additions & 0 deletions core/Migrations/Version32000Date20250620081925.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OC\Core\Migrations;

/**
* Run the old migration Version24000Date20211210141942 again.
*/
class Version32000Date20250620081925 extends Version24000Date20211210141942 {
}
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,7 @@
'OC\\Core\\Migrations\\Version31000Date20240101084401' => $baseDir . '/core/Migrations/Version31000Date20240101084401.php',
'OC\\Core\\Migrations\\Version31000Date20240814184402' => $baseDir . '/core/Migrations/Version31000Date20240814184402.php',
'OC\\Core\\Migrations\\Version31000Date20250213102442' => $baseDir . '/core/Migrations/Version31000Date20250213102442.php',
'OC\\Core\\Migrations\\Version32000Date20250620081925' => $baseDir . '/core/Migrations/Version32000Date20250620081925.php',
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php',
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Migrations\\Version31000Date20240101084401' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20240101084401.php',
'OC\\Core\\Migrations\\Version31000Date20240814184402' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20240814184402.php',
'OC\\Core\\Migrations\\Version31000Date20250213102442' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20250213102442.php',
'OC\\Core\\Migrations\\Version32000Date20250620081925' => __DIR__ . '/../../..' . '/core/Migrations/Version32000Date20250620081925.php',
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php',
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Config/UserConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,11 @@ private function setTypedValue(
int $flags,
ValueType $type,
): bool {
// Primary email addresses are always(!) expected to be lowercase
if ($app === 'settings' && $key === 'email') {
$value = strtolower($value);
}

$this->assertParams($userId, $app, $key);
if (!$this->matchAndApplyLexiconDefinition($userId, $app, $key, $lazy, $type, $flags)) {
// returns false as database is not updated
Expand Down
21 changes: 21 additions & 0 deletions tests/lib/AllConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ public function testSetUserValue(): void {
$config->deleteUserValue('userSet', 'appSet', 'keySet');
}

/**
* This test needs to stay! Emails are expected to be lowercase due to performance reasons.
* This way we can skip the expensive casing change on the database.
*/
public function testSetUserValueSettingsEmail(): void {
$selectAllSQL = 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?';
$config = $this->getConfig();

$config->setUserValue('userSet', 'settings', 'email', '[email protected]');

$result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll();

$this->assertEquals(1, count($result));
$this->assertEquals([
'userid' => 'userSet',
'appid' => 'settings',
'configkey' => 'email',
'configvalue' => '[email protected]'
], $result[0]);
}

public function testSetUserValueWithPreCondition(): void {
$config = $this->getConfig();

Expand Down
13 changes: 13 additions & 0 deletions tests/lib/Config/UserConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,19 @@ public function testSetValueMixed(
}
}

/**
* This test needs to stay! Emails are expected to be lowercase due to performance reasons.
* This way we can skip the expensive casing change on the database.
*/
public function testSetValueMixedWithSettingsEmail(): void {
$userConfig = $this->generateUserConfig();

$edited = $userConfig->setValueMixed('user1', 'settings', 'email', '[email protected]');
$this->assertTrue($edited);

$actual = $userConfig->getValueMixed('user1', 'settings', 'email');
$this->assertEquals('[email protected]', $actual);
}

public function providerSetValueString(): array {
return [
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patch level
// when updating major/minor version number.

$OC_Version = [31, 0, 6, 2];
$OC_Version = [31, 0, 6, 3];

// The human-readable string
$OC_VersionString = '31.0.6';
Expand Down
Loading