Skip to content

Respect user configuration for display name updates - #1189

Merged
come-nc merged 2 commits into
nextcloud:mainfrom
sushifrick:main
Oct 26, 2026
Merged

come-nc merged 2 commits into
nextcloud:mainfrom
sushifrick:main

Conversation

@sushifrick

Copy link
Copy Markdown
Contributor

Fixes #1188

This fix respects the instance's setting allow_user_to_change_display_name with a default true. The setting is meant to prevent spoofing other user names in bigger instances.

For now this setting can be circumvented by importing an export from another instance or one that has been manipulated after unzipping it.

Comment thread lib/Service/UserMigrationService.php Resolved

@come-nc come-nc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I just realized it looks like the whole permission checks are applied when importing as admin too, so occ user:import will not import display name anymore with this change.
But there is the same issue for all the other fields, so I guess it’s still fine to merge this for now.
But we would need a follow-up to bypass most permission checks when importing as admin (especially when importing in a new user).

@sushifrick

Copy link
Copy Markdown
Contributor Author

Hmm I guess you are right. I was wondering if the permission check was better suited in $user->setDisplayName() itself instead of during the migration here. Therefore the setting would be respected by each app calling it. What is your opinion on that?

@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@come-nc

come-nc commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Hmm I guess you are right. I was wondering if the permission check was better suited in $user->setDisplayName() itself instead of during the migration here. Therefore the setting would be respected by each app calling it. What is your opinion on that?

No, the permission check should stay outside of the method. The method can be used by admin endpoints as well.

@come-nc

come-nc commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

@sushifrick Can you add a sign-off to your commits to fix DCO?
git rebase HEAD~2 --signoff should be enough, and then a force-push.

…ervice

Signed-off-by: Sascha Frick <frick@rz.uni-kiel.de>
Signed-off-by: Sascha Frick <frick@rz.uni-kiel.de>
@come-nc
come-nc merged commit 194bc82 into nextcloud:main Oct 26, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comply with instance setting to disable change of user names during import

2 participants