diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/SystemController.php | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/Controller/SystemController.php b/lib/Controller/SystemController.php index ef695932..67b9bbc2 100644 --- a/lib/Controller/SystemController.php +++ b/lib/Controller/SystemController.php @@ -100,6 +100,7 @@ class SystemController extends Controller { /** * Get a list of NC users, groups and contacts * @NoAdminRequired + * @PublicPage * @NoCSRFRequired * @param string $query * @param bool $getGroups - search in groups @@ -111,8 +112,8 @@ class SystemController extends Controller { */ public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $getContacts = true, $getMail = false, $skipGroups = array(), $skipUsers = array()) { $list = array(); - // if (filter_var($query, FILTER_VALIDATE_EMAIL)) { - if ($this->isValidEmail($query)) { + + if ($getMail && $this->isValidEmail($query)) { $list[] = [ 'id' => '', 'user' => '', @@ -130,10 +131,8 @@ class SystemController extends Controller { ]; } - if ($getGroups) { - $groups = $this->groupManager->search($query); - foreach ($groups as $group) { + foreach ($this->groupManager->search($query) as $group) { if (!in_array($group->getGID(), $skipGroups)) { $list[] = [ 'id' => $group->getGID(), @@ -176,13 +175,9 @@ class SystemController extends Controller { } } - $contactsManager = \OC::$server->getContactsManager(); - - - if ($getContacts && $contactsManager->isEnabled()) { - $contacts = $contactsManager->search($query, array('FN', 'EMAIL', 'ORG', 'CATEGORIES')); + if ($getContacts && \OC::$server->getContactsManager()->isEnabled()) { - foreach ($contacts as $contact) { + foreach (\OC::$server->getContactsManager()->search($query, array('FN', 'EMAIL', 'ORG', 'CATEGORIES')) as $contact) { if (!array_key_exists('isLocalSystemBook', $contact) && array_key_exists('EMAIL', $contact)) { $emailAdresses = $contact['EMAIL']; @@ -205,9 +200,9 @@ class SystemController extends Controller { 'type' => 'contact', 'icon' => 'icon-mail', 'avatarURL' => '', - 'avatar' => isset($contact['PHOTO']) ? $contact['PHOTO'] : '', + 'avatar' => '', 'lastLogin' => '', - 'cloudId' => '' + 'cloudId' => '', ]; } |