From: poltawski Date: Wed, 22 Aug 2007 10:35:28 +0000 (+0000) Subject: MDL-10573 - moodle/block:view wasn't working with switch roles or block_list class X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=25a7d98066e6383e34f8c8731af0b260dc6f1526;p=moodle.git MDL-10573 - moodle/block:view wasn't working with switch roles or block_list class --- diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index 49d369cd8a..fbac19c462 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -689,6 +689,13 @@ class block_list extends block_base { var $content_type = BLOCK_TYPE_LIST; function is_empty() { + + $context = get_context_instance(CONTEXT_BLOCK, $this->instance->id); + + if ( !has_capability('moodle/block:view', $context) ) { + return true; + } + $this->get_content(); return (empty($this->content->items) && empty($this->content->footer)); } diff --git a/lib/db/access.php b/lib/db/access.php index 21511dbaf1..93bb8db45d 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -1153,7 +1153,11 @@ $moodle_capabilities = array( 'contextlevel' => CONTEXT_BLOCK, 'legacy' => array( 'guest' => CAP_ALLOW, - 'user' => CAP_ALLOW + 'user' => CAP_ALLOW, + 'student' => CAP_ALLOW, + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'coursecreator' => CAP_ALLOW ) ) );