From 25a7d98066e6383e34f8c8731af0b260dc6f1526 Mon Sep 17 00:00:00 2001 From: poltawski Date: Wed, 22 Aug 2007 10:35:28 +0000 Subject: [PATCH] MDL-10573 - moodle/block:view wasn't working with switch roles or block_list class --- blocks/moodleblock.class.php | 7 +++++++ lib/db/access.php | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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 ) ) ); -- 2.39.5