Skip to content

Commit

Permalink
Merge branch 'wip-MDL-48091-m27-2' of git://github.com/marinaglancy/m…
Browse files Browse the repository at this point in the history
…oodle into MOODLE_27_STABLE
  • Loading branch information
Damyon Wiese committed Nov 7, 2014
2 parents e88e7ae + bacb956 commit 125cb6d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions user/index.php
Expand Up @@ -440,19 +440,14 @@
$select .= $ccselect;
$joins[] = $ccjoin;

// We want to query both the current context and parent contexts.
list($relatedctxsql, $relatedctxparams) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');
$params = array_merge($params, $relatedctxparams);

// Limit list to users with some role only.
if ($roleid) {
// We want to query both the current context and parent contexts.
list($relatedctxsql, $relatedctxparams) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');

$wheres[] = "u.id IN (SELECT userid FROM {role_assignments} WHERE roleid = :roleid AND contextid $relatedctxsql)";
$params = array_merge($params, array('roleid' => $roleid));
} else {
$profileroles = explode(',', $CFG->profileroles);
list($insql, $inparams) = $DB->get_in_or_equal($profileroles, SQL_PARAMS_NAMED);
$wheres[] = "u.id IN (SELECT userid FROM {role_assignments} WHERE roleid $insql AND contextid $relatedctxsql)";
$params = array_merge($params, $inparams);
$params = array_merge($params, array('roleid' => $roleid), $relatedctxparams);
}

$from = implode("\n", $joins);
Expand Down

0 comments on commit 125cb6d

Please sign in to comment.