1
0

UserSearch.php 832 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Settings\Search;
  8. use OCP\IL10N;
  9. use OCP\IUser;
  10. use OCP\Search\IProvider;
  11. use OCP\Search\ISearchQuery;
  12. use OCP\Search\SearchResult;
  13. class UserSearch implements IProvider {
  14. public function __construct(
  15. private IL10N $l,
  16. ) {
  17. }
  18. public function getId(): string {
  19. return 'users';
  20. }
  21. public function getName(): string {
  22. return $this->l->t('Users');
  23. }
  24. public function getOrder(string $route, array $routeParameters): ?int {
  25. return str_starts_with($route, 'settings.Users.usersList')
  26. ? 300
  27. : null;
  28. }
  29. public function search(IUser $user, ISearchQuery $query): SearchResult {
  30. return SearchResult::complete($this->l->t('Users'), []);
  31. }
  32. }