diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 28b061351c5..4b2c1dfb215 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -290,7 +290,7 @@ $selectsql = ""; } - if ($context->contextlevel > CONTEXT_COURSE) { // mod or block (or group?) + if ($context->contextlevel > CONTEXT_COURSE && !is_inside_frontpage($context)) { // mod or block (or group?) /************************************************************************ * * diff --git a/lib/accesslib.php b/lib/accesslib.php index 1a5143ecf96..e619edb37af 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -3621,6 +3621,16 @@ function get_parent_contextid($context) { return array_shift($parentcontexts); } +/** + * @param object $context a context object. + * @return true if this context is the front page context, or a context inside it, + * otherwise false. + */ +function is_inside_frontpage($context) { + $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID); + return strpos($context->path . '/', $frontpagecontext->path . '/') === 0; +} + /** * Recursive function which, given a context, find all its children context ids. *