Skip to content
Permalink
Browse files

Only admins and hrm users can search for global users.

  • Loading branch information...
jmontoyaa committed Jan 25, 2019
1 parent 709740f commit 2937cf24cf6842c2f6ce9422028a1e5f9842ef09
Showing with 15 additions and 15 deletions.
  1. +15 −15 main/inc/ajax/user_manager.ajax.php
@@ -14,23 +14,23 @@
switch ($action) {
case 'get_user_like':
api_block_anonymous_users(false);
$query = $_REQUEST['q'];
$conditions = [
'username' => $query,
'firstname' => $query,
'lastname' => $query,
];
$users = UserManager::getUserListLike($conditions, [], false, 'OR');
$result = [];
if (!empty($users)) {
foreach ($users as $user) {
$result[] = ['id' => $user['id'], 'text' => $user['complete_name'].' ('.$user['username'].')'];
if (api_is_platform_admin() || api_is_drh()) {
$query = $_REQUEST['q'];
$conditions = [
'username' => $query,
'firstname' => $query,
'lastname' => $query,
];
$users = UserManager::getUserListLike($conditions, [], false, 'OR');
$result = [];
if (!empty($users)) {
foreach ($users as $user) {
$result[] = ['id' => $user['id'], 'text' => $user['complete_name'].' ('.$user['username'].')'];
}
$result['items'] = $result;
}
$result['items'] = $result;
echo json_encode($result);
}
echo json_encode($result);
break;
case 'get_user_popup':
$courseId = isset($_REQUEST['course_id']) ? (int) $_REQUEST['course_id'] : 0;

0 comments on commit 2937cf2

Please sign in to comment.
You can’t perform that action at this time.