Skip to content

Commit a24b41e

Browse files
committed
Check whether the user is null directly in handle() and expect a not nullable UserProfile in assertUserCanBeManaged()
1 parent f365456 commit a24b41e

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

wcfsetup/install/files/lib/action/UserBanAction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function performAction(UserProfile $userProfile, array $data): void
3737
}
3838

3939
#[\Override]
40-
protected function assertUserCanBeManaged(?UserProfile $userProfile): void
40+
protected function assertUserCanBeManaged(UserProfile $userProfile): void
4141
{
4242
parent::assertUserCanBeManaged($userProfile);
4343

wcfsetup/install/files/lib/action/UserDisableAvatarAction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function performAction(UserProfile $userProfile, array $data): void
3737
}
3838

3939
#[\Override]
40-
protected function assertUserCanBeManaged(?UserProfile $userProfile): void
40+
protected function assertUserCanBeManaged(UserProfile $userProfile): void
4141
{
4242
parent::assertUserCanBeManaged($userProfile);
4343

wcfsetup/install/files/lib/action/UserDisableCoverPhotoAction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function performAction(UserProfile $userProfile, array $data): void
3737
}
3838

3939
#[\Override]
40-
protected function assertUserCanBeManaged(?UserProfile $userProfile): void
40+
protected function assertUserCanBeManaged(UserProfile $userProfile): void
4141
{
4242
parent::assertUserCanBeManaged($userProfile);
4343

wcfsetup/install/files/lib/action/UserDisableSignatureAction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function performAction(UserProfile $userProfile, array $data): void
3737
}
3838

3939
#[\Override]
40-
protected function assertUserCanBeManaged(?UserProfile $userProfile): void
40+
protected function assertUserCanBeManaged(UserProfile $userProfile): void
4141
{
4242
parent::assertUserCanBeManaged($userProfile);
4343

wcfsetup/install/files/lib/action/UserManagementAction.class.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public function handle(ServerRequestInterface $request): ResponseInterface
3636
);
3737

3838
$user = UserProfileRuntimeCache::getInstance()->getObject($parameters['id']);
39+
40+
if (!$user) {
41+
throw new IllegalLinkException();
42+
}
43+
3944
$this->assertUserCanBeManaged($user);
4045

4146
$form = $this->getForm();
@@ -58,12 +63,8 @@ public function handle(ServerRequestInterface $request): ResponseInterface
5863
}
5964
}
6065

61-
protected function assertUserCanBeManaged(?UserProfile $userProfile): void
66+
protected function assertUserCanBeManaged(UserProfile $userProfile): void
6267
{
63-
if (!$userProfile) {
64-
throw new IllegalLinkException();
65-
}
66-
6768
if ($userProfile->userID === WCF::getUser()->userID) {
6869
throw new IllegalLinkException();
6970
}

0 commit comments

Comments
 (0)