add lookup route for displaynames
This commit is contained in:
parent
e09e11b93e
commit
91ba1b345e
|
@ -35,6 +35,10 @@ $this->create('core_ajax_share', '/core/ajax/share.php')
|
||||||
// Translations
|
// Translations
|
||||||
$this->create('core_ajax_translations', '/core/ajax/translations.php')
|
$this->create('core_ajax_translations', '/core/ajax/translations.php')
|
||||||
->actionInclude('core/ajax/translations.php');
|
->actionInclude('core/ajax/translations.php');
|
||||||
|
// User display names
|
||||||
|
$this->create('core_user_displaynames', '/displaynames')
|
||||||
|
->get()
|
||||||
|
->action('OC\Core\User\Controller', 'getDisplayNames');
|
||||||
// Tags
|
// Tags
|
||||||
$this->create('core_tags_tags', '/tags/{type}')
|
$this->create('core_tags_tags', '/tags/{type}')
|
||||||
->get()
|
->get()
|
||||||
|
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue