server/apps/files_sharing/ajax/userautocomplete.php

30 lines
698 B
PHP
Raw Normal View History

2011-07-24 19:47:37 +00:00
<?php
//$RUNTIME_NOAPPS = true;
2011-07-24 19:47:37 +00:00
2011-07-24 19:47:37 +00:00
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('files_sharing');
2011-07-24 19:47:37 +00:00
$users = array();
$groups = array();
2012-05-01 16:50:31 +00:00
$self = OCP\USER::getUser();
$userGroups = OC_Group::getUserGroups($self);
$users[] = "<optgroup label='Users'>";
$groups[] = "<optgroup label='Groups'>";
foreach ($userGroups as $group) {
$groupUsers = OC_Group::usersInGroup($group);
foreach ($groupUsers as $user) {
if ($user != $self) {
$users[] = "<option value='".$user."'>".$user."</option>";
}
2011-07-24 19:47:37 +00:00
}
$groups[] = "<option value='".$group."'>".$group."</option>";
2011-07-24 19:47:37 +00:00
}
$users[] = "</optgroup>";
$groups[] = "</optgroup>";
$users = array_merge($users, $groups);
OC_JSON::encodedPrint($users);
2011-07-24 19:47:37 +00:00
?>