summaryrefslogtreecommitdiffstats
path: root/core/user/controller.php
blob: cbcbd93618313e38c2356a1ddff078e6429da25f (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
/**
 * Copyright (c) 2014 Jörn Dreyer <jfd@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace OC\Core\User;

class Controller {
	public static function getDisplayNames($args) {
		\OC_JSON::checkLoggedIn();
		\OC_JSON::callCheck();

		$users = $_GET['users'];
		$result = array();
		$userManager = \OC::$server->getUserManager();

		foreach ($users as $user) {
			$userObject = $userManager->get($user);
			if (is_object($userObject)) {
				$result[$user] = $userObject->getDisplayName();
			} else {
				$result[$user] = false;
			}
		}

		\OC_JSON::success(array('users'=>$result));
	}
}