Skip to content

Commit 0882f51

Browse files
committed
fix(accounts): fix CI failures in admin scope ceiling feature
- Rename SCOPE_ORDER -> PROPERTY_SCOPE_ORDER to avoid matching the IAccountManager::SCOPE_* psalm wildcard used in IAccountProperty docblocks, which caused MismatchingDocblockParamType errors - Add missing parens around arrow function arg in FederationControl.vue to satisfy @stylistic/arrow-parens eslint rule - Inline arrow function body in PersonalInfo.php to satisfy rector formatting rules Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 41031dc commit 0882f51

4 files changed

Lines changed: 7 additions & 13 deletions

File tree

apps/settings/lib/Settings/Personal/PersonalInfo.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ public function getForm(): TemplateResponse {
117117

118118
$maxPropertyScopes = array_filter(
119119
$this->config->getSystemValue('account_manager.max_property_scope', []),
120-
static fn (string $scope, string $property): bool =>
121-
in_array($property, IAccountManager::ALLOWED_PROPERTIES, true)
122-
&& in_array($scope, IAccountManager::ALLOWED_SCOPES, true),
120+
static fn (string $scope, string $property): bool => in_array($property, IAccountManager::ALLOWED_PROPERTIES, true) && in_array($scope, IAccountManager::ALLOWED_SCOPES, true),
123121
ARRAY_FILTER_USE_BOTH,
124122
);
125123

apps/settings/src/components/PersonalInfo/shared/FederationControl.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default {
141141
if (maxScope) {
142142
const order = [SCOPE_ENUM.PRIVATE, SCOPE_ENUM.LOCAL, SCOPE_ENUM.FEDERATED, SCOPE_ENUM.PUBLISHED]
143143
const maxIndex = order.indexOf(maxScope)
144-
return scopes.filter(scope => order.indexOf(scope) <= maxIndex)
144+
return scopes.filter((scope) => order.indexOf(scope) <= maxIndex)
145145
}
146146
147147
return scopes

lib/private/Accounts/AccountManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ protected function testPropertyScope(IAccountProperty $property, array $allowedS
124124
$maxScopes = $this->config->getSystemValue('account_manager.max_property_scope', []);
125125
if (isset($maxScopes[$property->getName()])) {
126126
$maxScope = $maxScopes[$property->getName()];
127-
$currentOrder = self::SCOPE_ORDER[$property->getScope()] ?? 0;
128-
$maxOrder = self::SCOPE_ORDER[$maxScope] ?? PHP_INT_MAX;
127+
$currentOrder = self::PROPERTY_SCOPE_ORDER[$property->getScope()] ?? 0;
128+
$maxOrder = self::PROPERTY_SCOPE_ORDER[$maxScope] ?? PHP_INT_MAX;
129129
if ($currentOrder > $maxOrder) {
130130
if ($throwOnData) {
131131
throw new InvalidArgumentException('scope');

lib/public/Accounts/IAccountManager.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ interface IAccountManager {
6161

6262
/**
6363
* Visibility order of scopes from least to most visible.
64-
* Used to compare scope levels when enforcing admin-configured ceilings.
65-
*
66-
* Admins may configure a per-property scope ceiling via the system config
67-
* key `account_manager.max_property_scope` (array of property => scope).
68-
* A user may not set a property to a scope with a higher index than the
69-
* configured ceiling.
64+
* Used to compare scope levels when enforcing admin-configured ceilings
65+
* via the ``account_manager.max_property_scope`` system config key.
7066
*
7167
* Warning: restricting properties that federation depends on
7268
* (``PROPERTY_DISPLAYNAME``, ``PROPERTY_EMAIL``, ``PROPERTY_AVATAR``,
@@ -75,7 +71,7 @@ interface IAccountManager {
7571
*
7672
* @since 32.0.0
7773
*/
78-
public const SCOPE_ORDER = [
74+
public const PROPERTY_SCOPE_ORDER = [
7975
self::SCOPE_PRIVATE => 0,
8076
self::SCOPE_LOCAL => 1,
8177
self::SCOPE_FEDERATED => 2,

0 commit comments

Comments
 (0)