Welcome to mirror list, hosted at ThFree Co, Russian Federation.

userautocomplete.php « ajax « files_sharing « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 99cc81bce04d15383b4b07ec72cac71febe92570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_sharing');

$users = array();
$groups = array();
$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);
	$userCount = 0;
	foreach ($groupUsers as $user) {
		if ($user != $self) {
			$users[] = "<option value='".$user."'>".$user."</option>";
			$userCount++;
		}
	}
	// Don't include the group if only the current user is a member of it
	if ($userCount > 0) {
		$groups[] = "<option value='".$group."(group)'>".$group." (group) </option>";
	}
}
$users[] = "</optgroup>";
$groups[] = "</optgroup>";
$users = array_merge($users, $groups);
OCP\JSON::encodedPrint($users);

?>