diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-07-24 16:07:39 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-07-24 16:07:39 -0400 |
commit | 5148eb9121e3d19211629ea29ac3ebf70b111ef6 (patch) | |
tree | 59ee09bad19c7e2d44d3d04d433521cf56cf866e /apps/files_sharing/ajax/userautocomplete.php | |
parent | 4282a42b3f0be65bb22f12ed297602043c3ecbbb (diff) | |
download | nextcloud-server-5148eb9121e3d19211629ea29ac3ebf70b111ef6.tar.gz nextcloud-server-5148eb9121e3d19211629ea29ac3ebf70b111ef6.zip |
Include groups in user autocomplete
Diffstat (limited to 'apps/files_sharing/ajax/userautocomplete.php')
-rw-r--r-- | apps/files_sharing/ajax/userautocomplete.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php index b6285aba9b9..6e1469ae348 100644 --- a/apps/files_sharing/ajax/userautocomplete.php +++ b/apps/files_sharing/ajax/userautocomplete.php @@ -3,8 +3,8 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); -if( !OC_USER::isLoggedIn()){ - echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); +if (!OC_USER::isLoggedIn()) { + echo json_encode(array("status" => "error", "data" => array("message" => "Authentication error"))); exit(); } $query = $_GET['term']; @@ -13,11 +13,17 @@ $query = strtolower($query); $users = array(); $ocusers = OC_USER::getUsers(); $self = OC_USER::getUser(); +$groups = OC_GROUP::getUserGroups($self); foreach ($ocusers as $user) { if ($user != $self && substr(strtolower($user), 0, $length) == $query) { $users[] = (object)array('id' => $user, 'label' => $user, 'name' => $user); } } +foreach ($groups as $group) { + if (substr(strtolower($group), 0, $length) == $query) { + $users[] = (object)array('id' => $group, 'label' => $group, 'name' => $group); + } +} echo json_encode($users); ?> |