nextcloud/apps/files_sharing/ajax/userautocomplete.php

28 lines
640 B
PHP
Raw Normal View History

2011-07-24 23:47:37 +04:00
<?php
$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('files_sharing');
2011-07-24 23:47:37 +04:00
$users = array();
$ocusers = OC_User::getUsers();
$self = OC_User::getUser();
2011-08-14 19:44:37 +04:00
$groups = OC_Group::getUserGroups($self);
$users[] = "<optgroup label='Users'>";
2011-07-24 23:47:37 +04:00
foreach ($ocusers as $user) {
if ($user != $self) {
$users[] = "<option value='".$user."'>".$user."</option>";
2011-07-24 23:47:37 +04:00
}
}
$users[] = "</optgroup>";
$users[] = "<optgroup label='Groups'>";
2011-07-25 00:07:39 +04:00
foreach ($groups as $group) {
$users[] = "<option value='".$group."'>".$group."</option>";
2011-07-25 00:07:39 +04:00
}
$users[] = "</optgroup>";
OC_JSON::encodedPrint($users);
2011-07-24 23:47:37 +04:00
?>