Skip to content

[stable30] fix(settings): Handle email change restriction separately from display name change restriction - #51900

Merged
Altahrim merged 3 commits into
stable30from
backport/51745/stable30
Apr 3, 2025
Merged

[stable30] fix(settings): Handle email change restriction separately from display name change restriction#51900
Altahrim merged 3 commits into
stable30from
backport/51745/stable30

Conversation

@backportbot

@backportbotbackportbotBot commented Apr 3, 2025

Copy link
Copy Markdown

Backport of #51745

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Remove all the empty commits

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

$allowDisplayNameChange = $this->config->getSystemValue('allow_user_to_change_display_name', true);
if ($allowDisplayNameChange === true && (
$targetUser->getBackend() instanceof ISetDisplayNameBackend
|| $targetUser->getBackend()->implementsActions(Backend::SET_DISPLAYNAME)

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method implementsActions on possibly null value
$allowDisplayNameChange = $this->config->getSystemValue('allow_user_to_change_display_name', true);
if ($allowDisplayNameChange === true && (
$targetUser->getBackend() instanceof ISetDisplayNameBackend
|| $targetUser->getBackend()->implementsActions(Backend::SET_DISPLAYNAME)

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OCP\UserInterface::implementsActions has been marked as deprecated
$allowDisplayNameChange = $this->config->getSystemValue('allow_user_to_change_display_name', true);
if ($allowDisplayNameChange !== false && (
$targetUser->getBackend() instanceof ISetDisplayNameBackend
|| $targetUser->getBackend()->implementsActions(Backend::SET_DISPLAYNAME)

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method implementsActions on possibly null value
$allowDisplayNameChange = $this->config->getSystemValue('allow_user_to_change_display_name', true);
if ($allowDisplayNameChange !== false && (
$targetUser->getBackend() instanceof ISetDisplayNameBackend
|| $targetUser->getBackend()->implementsActions(Backend::SET_DISPLAYNAME)

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OCP\UserInterface::implementsActions has been marked as deprecated
@susnux
susnuxforce-pushed the backport/51745/stable30 branch from 747c3b9 to 9d1baceCompareApril 3, 2025 06:42
@susnux
susnux marked this pull request as ready for review April 3, 2025 06:42
@susnux
susnuxforce-pushed the backport/51745/stable30 branch from 9d1bace to b8203ddCompareApril 3, 2025 06:45
@susnux

Copy link
Copy Markdown
Contributor

/compile

$accountParameters = [
'avatarChangeSupported' => $user->canChangeAvatar(),
'displayNameChangeSupported' => $user->canChangeDisplayName(),
'emailChangeSupported' => $user->canChangeEmail(),

Check notice

Code scanning / Psalm

UndefinedInterfaceMethod

Method OCP\IUser::canChangeEmail does not exist

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems legit @susnux ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes but intentional.
Its not on the public interface (no backport of public interface changes), but on the private implementation.

$permittedFields[] = IAccountManager::PROPERTY_DISPLAYNAME;
}
$allowDisplayNameChange = $this->config->getSystemValue('allow_user_to_change_display_name', true);
if ($allowDisplayNameChange !== false && (

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method getUID on possibly null value
@AltahrimAltahrim mentioned this pull request Apr 3, 2025
5 tasks
provokateurinand others added 3 commits April 3, 2025 16:12
…y name change restriction
Co-authored-by: provokateurin <kate@provokateurin.de>
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Louis <louis@chmn.me>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@Altahrim
Altahrimforce-pushed the backport/51745/stable30 branch from 1af09b0 to 185e97bCompareApril 3, 2025 14:12
@Altahrim

Copy link
Copy Markdown
Collaborator

Rebased

@Altahrim
Altahrim enabled auto-merge April 3, 2025 14:32
@Altahrim
Altahrim merged commit 2f22c0d into stable30Apr 3, 2025
@Altahrim
Altahrim deleted the backport/51745/stable30 branch April 3, 2025 15:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@susnux@Altahrim@AndyScherzinger@github-advanced-security@provokateurin@nextcloud-command