feat(accounts): add admin-configurable per-property scope ceiling#60350
Draft
miaulalala wants to merge 1 commit into
Draft
feat(accounts): add admin-configurable per-property scope ceiling#60350miaulalala wants to merge 1 commit into
miaulalala wants to merge 1 commit into
Conversation
Admins can now set a maximum allowed visibility scope per account property via the system config key `account_manager.max_property_scope` (array of property name => max scope, e.g. `['email' => 'v2-local', 'website' => 'v2-local']`). Backend (`AccountManager::testPropertyScope`) rejects any scope that exceeds the configured ceiling, returning `Invalid scope` via the API. The frontend (`FederationControl.vue`) also filters out disallowed scope options so users only see choices their admin permits. `PersonalInfo.php` sanitises and passes the config to the frontend via initial state. `IAccountManager` adds `PROPERTY_SCOPE_ORDER` documenting the visibility ordering used for ceiling comparisons. Also fixes a latent mutation bug in `FederationControl.vue` where `supportedScopes` was calling `.push()` on the inner arrays of the `Object.freeze`d `PROPERTY_READABLE_SUPPORTED_SCOPES_ENUM` constant, causing duplicate entries to accumulate across re-renders. Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0882f51 to
2b68a36
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Admins can now enforce a maximum visibility scope per account property via
config.php:AccountManager::testPropertyScope): rejects any scope exceeding the configured ceiling — API returnsInvalid scope (101)FederationControl.vue): readsmaxPropertyScopesfromaccountParametersinitial state and filters out disallowed options from the scope picker, so users only see choices their admin permitsPersonalInfo.php: sanitises and passesaccount_manager.max_property_scopeto the frontend (only valid property/scope pairs are forwarded)IAccountManager: addsSCOPE_ORDERconstant documenting the visibility ordering used for ceiling comparisonsAlso fixes a latent mutation bug in
FederationControl.vuewheresupportedScopeswas pushing into the inner arrays of theObject.freezedPROPERTY_READABLE_SUPPORTED_SCOPES_ENUMconstant, causing duplicate entries to accumulate across re-renders.Test plan
NOCOVERAGE=1 ./autotest.sh sqlite tests/lib/Accounts/AccountManagerTest.php— all 54 tests pass including 3 new ones'account_manager.max_property_scope' => ['website' => 'v2-local']toconfig.phpPUT /ocs/v2.php/cloud/users/<uid>withwebsiteScope=v2-federatedreturns 400websiteScope=v2-localsucceeds🤖 Generated with Claude Code