From f9d68a11da63c07df42148759a21c8e6ab8484f4 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Wed, 5 Jun 2013 18:06:56 +1000 Subject: [PATCH] MDL-21097 Correctly check capabilities for frontpage editing mode --- index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 0e8398b1126..ce56de5cf6a 100644 --- a/index.php +++ b/index.php @@ -40,6 +40,9 @@ } $PAGE->set_url('/', $urlparams); $PAGE->set_course($SITE); + $PAGE->set_other_editing_capability('moodle/course:update'); + $PAGE->set_other_editing_capability('moodle/course:manageactivities'); + $PAGE->set_other_editing_capability('moodle/course:activityvisibility'); // Prevent caching of this page to stop confusion when changing page after making AJAX changes $PAGE->set_cacheable(false); @@ -89,8 +92,6 @@ } $PAGE->set_pagetype('site-index'); - $PAGE->set_other_editing_capability('moodle/course:manageactivities'); - $PAGE->set_other_editing_capability('moodle/course:activityvisibility'); $PAGE->set_docs_path(''); $PAGE->set_pagelayout('frontpage'); $editing = $PAGE->user_is_editing(); @@ -137,7 +138,7 @@ echo format_text($summarytext, $section->summaryformat, $summaryformatoptions); - if ($editing) { + if ($editing && has_capability('moodle/course:update', $context)) { $streditsummary = get_string('editsummary'); echo "id\">pix_url('t/edit') . "\" ".