mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 13:33:52 +02:00
MDL-37207 modchoosertoggle: added checks that user can update course
This commit is contained in:
parent
c5c50786f6
commit
aa2b293e8e
@ -64,8 +64,14 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
// Add the module chooser toggle to the course page
|
||||
if ($modchoosertoggleadded || $this->page->state > moodle_page::STATE_PRINTING_HEADER ||
|
||||
$this->page->course->id == SITEID ||
|
||||
!($coursenode = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE))) {
|
||||
!$this->page->user_is_editing() ||
|
||||
!($context = context_course::instance($this->page->course->id)) ||
|
||||
!has_capability('moodle/course:update', $context) ||
|
||||
!course_ajax_enabled($this->page->course) ||
|
||||
!($coursenode = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE)) ||
|
||||
!$coursenode->get('editsettings')) {
|
||||
// too late or we are on site page or we could not find the course settings node
|
||||
// or we are not allowed to edit
|
||||
return;
|
||||
}
|
||||
$modchoosertoggleadded = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user