From: toyomoyo Date: Mon, 26 Mar 2007 02:55:03 +0000 (+0000) Subject: patching up module level manageactivies capability so that you only need it assigned... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5c91baaa46e662e7076dbbbc475f5459ea66da5c;p=moodle.git patching up module level manageactivies capability so that you only need it assigned at mod level to update an activity --- diff --git a/lib/pagelib.php b/lib/pagelib.php index 879f11b035..15238eec65 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -350,7 +350,7 @@ class page_course extends page_base { if (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM)) && defined('ADMIN_STICKYBLOCKS')) { return true; } - + $coursecontext = get_context_instance(CONTEXT_COURSE, $this->id); $capcheck = false; if (has_capability('moodle/course:manageactivities', $coursecontext) || @@ -598,7 +598,9 @@ class page_generic_activity extends page_base { function user_allowed_editing() { $this->init_full(); - return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_COURSE, $this->modulerecord->course)); + // Yu: I think this is wrong, should be checking manageactivities instead + //return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_COURSE, $this->modulerecord->course)); + return has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_MODULE, $this->modulerecord->id)); } function user_is_editing() {