diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 839861094f0..3010fb8fd7d 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -2622,11 +2622,6 @@ - - - - - @@ -2749,11 +2744,6 @@ - - - - - @@ -2779,9 +2769,6 @@ - - - @@ -2797,11 +2784,6 @@ - - - - - @@ -2848,41 +2830,6 @@ - - - - - - - - - - - - - getUID())]]> - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index 517bc6ae564..0fc116936c9 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -48,7 +48,7 @@ class GenerateMetadataJob extends TimedJob { $lastHandledUser = $this->appConfig->getValueString('core', 'metadataGenerationLastHandledUser', ''); - $users = $this->userManager->search(''); + $users = $this->userManager->searchDisplayName(''); // we'll only start timer once we have found a valid user to handle // meaning NOW if we have not handled any user from a previous run diff --git a/core/Command/Group/AddUser.php b/core/Command/Group/AddUser.php index 999113390af..2a74452949d 100644 --- a/core/Command/Group/AddUser.php +++ b/core/Command/Group/AddUser.php @@ -71,7 +71,7 @@ class AddUser extends Base { } $members = array_map(static fn (IUser $user) => $user->getUID(), $group->searchUsers($context->getCurrentWord())); - $users = array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); + $users = array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); return array_diff($users, $members); } return []; diff --git a/core/Command/Preview/ResetRenderedTexts.php b/core/Command/Preview/ResetRenderedTexts.php index 4cae315e48b..ce874e15406 100644 --- a/core/Command/Preview/ResetRenderedTexts.php +++ b/core/Command/Preview/ResetRenderedTexts.php @@ -79,7 +79,7 @@ class ResetRenderedTexts extends Command { } private function getAvatarsToDelete(): \Iterator { - foreach ($this->userManager->search('') as $user) { + foreach ($this->userManager->searchDisplayName('') as $user) { $avatar = $this->avatarManager->getAvatar($user->getUID()); if (!$avatar->isCustomAvatar()) { diff --git a/core/Command/TwoFactorAuth/Base.php b/core/Command/TwoFactorAuth/Base.php index 034ea36afca..ec4faf0835b 100644 --- a/core/Command/TwoFactorAuth/Base.php +++ b/core/Command/TwoFactorAuth/Base.php @@ -40,7 +40,7 @@ class Base extends \OC\Core\Command\Base { if ($argumentName === 'uid') { return array_map(function (IUser $user) { return $user->getUID(); - }, $this->userManager->search($context->getCurrentWord(), 100)); + }, $this->userManager->searchDisplayName($context->getCurrentWord(), 100)); } return []; } diff --git a/core/Command/User/Disable.php b/core/Command/User/Disable.php index 4713950bf30..71d7d3087c4 100644 --- a/core/Command/User/Disable.php +++ b/core/Command/User/Disable.php @@ -55,7 +55,7 @@ class Disable extends Base { return array_map( static fn (IUser $user) => $user->getUID(), array_filter( - $this->userManager->search($context->getCurrentWord()), + $this->userManager->searchDisplayName($context->getCurrentWord()), static fn (IUser $user) => $user->isEnabled() ) ); diff --git a/core/Command/User/Enable.php b/core/Command/User/Enable.php index 23f56e5dd4f..7edd1849886 100644 --- a/core/Command/User/Enable.php +++ b/core/Command/User/Enable.php @@ -55,7 +55,7 @@ class Enable extends Base { return array_map( static fn (IUser $user) => $user->getUID(), array_filter( - $this->userManager->search($context->getCurrentWord()), + $this->userManager->searchDisplayName($context->getCurrentWord()), static fn (IUser $user) => !$user->isEnabled() ) ); diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php index e7fc9286e74..f8339f96056 100644 --- a/core/Command/User/Info.php +++ b/core/Command/User/Info.php @@ -7,6 +7,7 @@ namespace OC\Core\Command\User; use OC\Core\Command\Base; +use OC\Files\SetupManager; use OCP\Files\NotFoundException; use OCP\IGroupManager; use OCP\IUser; @@ -21,6 +22,7 @@ class Info extends Base { public function __construct( protected IUserManager $userManager, protected IGroupManager $groupManager, + protected SetupManager $setupManager, ) { parent::__construct(); } @@ -82,8 +84,8 @@ class Info extends Base { * @return array */ protected function getStorageInfo(IUser $user): array { - \OC_Util::tearDownFS(); - \OC_Util::setupFS($user->getUID()); + $this->setupManager->tearDown(); + $this->setupManager->setupForUser($user); try { $storage = \OC_Helper::getStorageInfo('/'); } catch (NotFoundException $e) { @@ -105,7 +107,7 @@ class Info extends Base { */ public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'user') { - return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); + return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); } return []; } diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index 984def72cd6..514396f9f52 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -88,7 +88,7 @@ class LastSeen extends Base { */ public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'uid') { - return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); + return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); } return []; } diff --git a/core/Command/User/Profile.php b/core/Command/User/Profile.php index fd5fbed08cd..b12dc697cb3 100644 --- a/core/Command/User/Profile.php +++ b/core/Command/User/Profile.php @@ -215,7 +215,7 @@ class Profile extends Base { */ public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'uid') { - return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); + return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); } if ($argumentName === 'key') { $userId = $context->getWordAtIndex($context->getWordIndex() - 1); diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index 0e8b1325770..c1759533d39 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -122,7 +122,7 @@ class ResetPassword extends Base { */ public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'user') { - return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); + return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->searchDisplayName($context->getCurrentWord())); } return []; }