-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix(accounts): default property scopes to local instead of federated #58759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ const store = useUserConfigStore() | |
| </NcFormBox> | ||
| <NcRadioGroup | ||
| v-model="store.userConfig.default_view" | ||
| name="default_view" | ||
| :label="t('files', 'Default view')" | ||
|
Comment on lines
38
to
41
|
||
| @update:modelValue="store.update('default_view', $event)"> | ||
| <NcRadioGroupButton :label="t('files', 'All files')" value="files"> | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this related? |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this related? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| namespace OC\Core\Migrations; | ||
|
|
||
| use Closure; | ||
| use OCP\DB\ISchemaWrapper; | ||
| use OCP\Migration\Attributes\ModifyColumn; | ||
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\SimpleMigrationStep; | ||
| use Override; | ||
|
|
||
| /** | ||
| * Increase bucket_name column length to 63 to match AWS bucket naming rules | ||
| */ | ||
| #[ModifyColumn(table: 'preview_locations', name: 'bucket_name', description: 'Increase column length to 63 to match AWS bucket naming rules')] | ||
| class Version33000Date20260306120000 extends SimpleMigrationStep { | ||
|
Comment on lines
+18
to
+22
|
||
|
|
||
| #[Override] | ||
| public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { | ||
| /** @var ISchemaWrapper $schema */ | ||
| $schema = $schemaClosure(); | ||
|
|
||
| if ($schema->hasTable('preview_locations')) { | ||
| $table = $schema->getTable('preview_locations'); | ||
| $column = $table->getColumn('bucket_name'); | ||
|
|
||
| if ($column->getLength() < 63) { | ||
| $column->setLength(63); | ||
| } | ||
| } | ||
|
|
||
| return $schema; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| namespace OC\Repair\NC33; | ||
|
|
||
| use OCP\Accounts\IAccountManager; | ||
| use OCP\IDBConnection; | ||
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\IRepairStep; | ||
|
|
||
| /** | ||
| * Fix default account property scopes from federated to local. | ||
| * | ||
| * Previously, properties like displayname, email, avatar, and pronouns | ||
| * defaulted to SCOPE_FEDERATED, which exposed user information to | ||
| * federated servers without explicit user consent. | ||
| * | ||
| * This repair step changes those properties to SCOPE_LOCAL for existing | ||
| * users who still have the old default federated scope on properties | ||
| * that were previously defaulting to federated. | ||
| * | ||
| * @see https://github.com/nextcloud/server/issues/58646 | ||
| */ | ||
| class FixDefaultAccountScopesToLocal implements IRepairStep { | ||
|
|
||
| /** | ||
| * Properties whose default scope was changed from federated to local. | ||
| */ | ||
| private const AFFECTED_PROPERTIES = [ | ||
| IAccountManager::PROPERTY_DISPLAYNAME, | ||
| IAccountManager::PROPERTY_EMAIL, | ||
| IAccountManager::PROPERTY_AVATAR, | ||
| IAccountManager::PROPERTY_PRONOUNS, | ||
| ]; | ||
|
|
||
| public function __construct( | ||
| private IDBConnection $connection, | ||
| ) { | ||
| } | ||
|
|
||
| public function getName(): string { | ||
| return 'Fix default account property scopes from federated to local'; | ||
| } | ||
|
|
||
| public function run(IOutput $output): void { | ||
| $updated = 0; | ||
| $processed = 0; | ||
|
|
||
| $select = $this->connection->getQueryBuilder(); | ||
| $select->select('uid', 'data') | ||
| ->from('accounts'); | ||
|
|
||
| $update = $this->connection->getQueryBuilder(); | ||
| $update->update('accounts') | ||
| ->set('data', $update->createParameter('data')) | ||
| ->where($update->expr()->eq('uid', $update->createParameter('uid'))); | ||
|
|
||
| $result = $select->executeQuery(); | ||
| while ($row = $result->fetch()) { | ||
| $processed++; | ||
| $data = json_decode($row['data'], true); | ||
| if (!is_array($data)) { | ||
|
Comment on lines
+54
to
+67
|
||
| continue; | ||
| } | ||
|
|
||
| $changed = false; | ||
| foreach (self::AFFECTED_PROPERTIES as $property) { | ||
| if (isset($data[$property]['scope']) | ||
| && $data[$property]['scope'] === IAccountManager::SCOPE_FEDERATED | ||
| ) { | ||
| $data[$property]['scope'] = IAccountManager::SCOPE_LOCAL; | ||
| $changed = true; | ||
| } | ||
|
Comment on lines
+71
to
+78
|
||
| } | ||
|
|
||
| if ($changed) { | ||
| $update->setParameter('data', json_encode($data)); | ||
| $update->setParameter('uid', $row['uid']); | ||
| $update->executeStatement(); | ||
| $updated++; | ||
| } | ||
| } | ||
| $result->closeCursor(); | ||
|
|
||
| $output->info("Processed $processed accounts, updated $updated accounts with local scope defaults."); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related?