diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-08-22 16:06:46 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-08-25 11:50:19 +0200 |
commit | 91ba1b345eff63b79f7111385d1e06e36911a589 (patch) | |
tree | 8defa07b2a3ffdc779af464903b148a390010e2e /core/user | |
parent | e09e11b93ec609e63d81f18f78b94792e875ee90 (diff) | |
download | nextcloud-server-91ba1b345eff63b79f7111385d1e06e36911a589.tar.gz nextcloud-server-91ba1b345eff63b79f7111385d1e06e36911a589.zip |
add lookup route for displaynames
Diffstat (limited to 'core/user')
-rw-r--r-- | core/user/controller.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/user/controller.php b/core/user/controller.php new file mode 100644 index 00000000000..cbcbd936183 --- /dev/null +++ b/core/user/controller.php @@ -0,0 +1,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)); + } +} |