diff options
-rw-r--r-- | appinfo/routes.php | 2 | ||||
-rw-r--r-- | lib/Controller/SystemController.php | 22 | ||||
-rw-r--r-- | src/js/components/SideBar/SideBarTabShare.vue | 2 |
3 files changed, 10 insertions, 16 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 50a9860c..658fa241 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -71,7 +71,7 @@ return [ ['name' => 'acl#getByToken', 'url' => '/acl/get/s/{token}', 'verb' => 'GET'], ['name' => 'acl#get', 'url' => '/acl/get/{id}', 'verb' => 'GET'], - ['name' => 'system#get_site_users_and_groups', 'url' => '/siteusers/get/', 'verb' => 'POST'], + ['name' => 'system#get_site_users_and_groups', 'url' => '/siteusers/get', 'verb' => 'POST'], ['name' => 'system#validate_public_username', 'url' => '/check/username', 'verb' => 'POST'] ] ]; diff --git a/lib/Controller/SystemController.php b/lib/Controller/SystemController.php index 86051bfb..894a7893 100644 --- a/lib/Controller/SystemController.php +++ b/lib/Controller/SystemController.php @@ -94,6 +94,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 @@ -105,7 +106,7 @@ 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)) { $list[] = [ 'id' => '', @@ -124,10 +125,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(), @@ -149,8 +148,7 @@ class SystemController extends Controller { } if ($getUsers) { - $users = $this->userManager->searchDisplayName($query); - foreach ($users as $user) { + foreach ($this->userManager->searchDisplayName($query) as $user) { if (!in_array($user->getUID(), $skipUsers)) { $list[] = [ 'id' => $user->getUID(), @@ -170,13 +168,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']; @@ -199,9 +193,9 @@ class SystemController extends Controller { 'type' => 'contact', 'icon' => 'icon-mail', 'avatarURL' => '', - 'avatar' => isset($contact['PHOTO']) ? $contact['PHOTO'] : '', + 'avatar' => '', 'lastLogin' => '', - 'cloudId' => '' + 'cloudId' => '', ]; } diff --git a/src/js/components/SideBar/SideBarTabShare.vue b/src/js/components/SideBar/SideBarTabShare.vue index 9ffd3161..12ba4314 100644 --- a/src/js/components/SideBar/SideBarTabShare.vue +++ b/src/js/components/SideBar/SideBarTabShare.vue @@ -146,7 +146,7 @@ export default { loadUsersAsync(query) { this.isLoading = false this.siteUsersListOptions.query = query - axios.post(generateUrl('apps/polls/siteusers/get/'), this.siteUsersListOptions) + axios.post(generateUrl('apps/polls/siteusers/get'), this.siteUsersListOptions) .then((response) => { this.users = response.data.siteusers this.isLoading = false |