Include groups in user autocomplete
This commit is contained in:
parent
4282a42b3f
commit
5148eb9121
1 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue