refactor(provisioning_api): consolidate user-edit field logic#61065
Open
pringelmann wants to merge 1 commit into
Open
refactor(provisioning_api): consolidate user-edit field logic#61065pringelmann wants to merge 1 commit into
pringelmann wants to merge 1 commit into
Conversation
8b98773 to
8d5bbab
Compare
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
8d5bbab to
d55e147
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.
new usermodal to edit users (user management) #40903Summary
Stage 1 of consolidating the two user-update endpoints:
editUser(single-field PUT)editUserMultiField(multi-field PATCH)These duplicated the per-field validate/apply rules. This extracts them into
private helpers and routes both endpoints through them, so each rule lives in
one place.
Mostly a refactor, but unifying the two endpoints' rules changes behavior in
three places. All intended:
canEditProperty('email'), same as PUTalready did. A self user whose email is locked (
allow_user_to_change_email=false,or an LDAP-mapped account) can no longer change it via PATCH.
force_languagepolicy in the language branch, so asubadmin editing another user is blocked when
force_languageis set(previously it only checked the language exists).
IEmailValidator, so the accepted/rejected setshifts vs
filter_var(e.g.user@localhostis accepted on non-strict instances).Request/response shapes and the OCS error codes / HTTP statuses are otherwise
unchanged. Existing tests still pass (a few updated slightly); new unit tests cover each helper plus the three
changes above.
Stage 2 will expand PATCH to full field parity and make
editUsera thin wrapperover it. Left out here so this stays scoped, since rerouting the long-standing
editUserpath is a bigger behavioral change that warrants its own review imo.Checklist
3. to review, feature component)stable32)AI