From 003273a71f79e9ac0c4f96321720cbf3c9b05bae Mon Sep 17 00:00:00 2001 From: Tomo <54526084+TomoTsuyuki@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:19:27 +1100 Subject: [PATCH] Issue #87 Do not display content if a user does not have permission (#93) --- block_massaction.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block_massaction.php b/block_massaction.php index 7192b49..a948b27 100644 --- a/block_massaction.php +++ b/block_massaction.php @@ -92,6 +92,11 @@ public function get_content(): stdClass { $this->content->footer = ''; if ($this->page->user_is_editing()) { + $blockcontext = context_block::instance($this->instance->id); + if (!has_capability('block/massaction:use', $blockcontext)) { + $this->content->text = get_string('nopermissions', 'error', get_string('massaction:use', 'block_massaction')); + return $this->content; + } $applicableformatkey = 'course-view-' . $COURSE->format; $iscoursecompatible = in_array($applicableformatkey, array_keys($this->applicable_formats()))