[TASK] Extend username search in beuser module 30/45930/4
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 15 Jan 2016 11:44:38 +0000 (12:44 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 15 Jan 2016 12:09:47 +0000 (13:09 +0100)
The search for a username searches now also in the columns
"uid" and "realName".

Change-Id: I8401e3c6cf73465f60a2c851dd87f28c3e0bff5c
Resolves: #72317
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/45930
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/beuser/Classes/Domain/Repository/BackendUserRepository.php

index 1bf84cd..72667da 100644 (file)
@@ -46,10 +46,13 @@ class BackendUserRepository extends \TYPO3\CMS\Extbase\Domain\Repository\Backend
         $query->setOrderings(array('userName' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING));
         // Username
         if ($demand->getUserName() !== '') {
-            $constraints[] = $query->like(
-                'userName',
-                '%' . $GLOBALS['TYPO3_DB']->escapeStrForLike($demand->getUserName(), 'be_users') . '%'
-            );
+            $searchConstraints = array();
+            foreach (array('userName', 'uid', 'realName') as $field) {
+                 $searchConstraints[] = $query->like(
+                    $field, '%' . $GLOBALS['TYPO3_DB']->escapeStrForLike($demand->getUserName(), 'be_users') . '%'
+                );
+            }
+            $constraints[] = $query->logicalOr($searchConstraints);
         }
         // Only display admin users
         if ($demand->getUserType() == \TYPO3\CMS\Beuser\Domain\Model\Demand::USERTYPE_ADMINONLY) {