From 50569ba3ace7b25b56792cc956a3a4fa39ef6268 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Fri, 2 Oct 2009 07:05:02 +0000 Subject: [PATCH] MDL-15262 Added a two capabilities to prevent certain users from changing a course's fullname and shortname. merged from MOODLE_19_STABLE --- course/edit_form.php | 9 +++++++++ lang/en_utf8/role.php | 7 +++++++ lib/db/access.php | 24 ++++++++++++++++++++++++ version.php | 2 +- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/course/edit_form.php b/course/edit_form.php index d5ff0e6823..fc4a3ab595 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -71,6 +71,11 @@ class course_edit_form extends moodleform { $mform->setDefault('category', $category->id); $mform->setType('category', PARAM_INT); + if ($course and !has_capability('moodle/course:changecategory', $coursecontext)) { + $mform->hardFreeze('category'); + $mform->setConstant('category', $category->id); + } + $fullname = get_string('defaultcoursefullname'); $shortname = get_string('defaultcourseshortname'); while ($DB->record_exists('course', array('fullname'=>$fullname)) @@ -113,6 +118,10 @@ class course_edit_form extends moodleform { $mform->setHelpButton('summary', array('text2', get_string('helptext')), true); $mform->setType('summary', PARAM_RAW); + if ($course and !has_capability('moodle/course:changesummary', $coursecontext)) { + $mform->hardFreeze('summary'); + } + $courseformats = get_plugin_list('format'); $formcourseformats = array(); foreach ($courseformats as $courseformat => $formatdir) { diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index ed5995df4b..f704ba894f 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -24,11 +24,16 @@ $string['assignglobalroles'] = 'Assign system roles'; $string['assignmentcontext'] = 'Assignment context'; $string['assignmentoptions'] = 'Assignment options'; $string['backtoallroles'] = 'Back to the list of all roles'; +$string['blog:associatecourse'] = 'Associate blog entries with courses'; +$string['blog:associatemodule'] = 'Associate blog entries with activity modules'; $string['blog:create'] = 'Create new blog entries'; $string['blog:manageentries'] = 'Edit and manage entries'; +$string['blog:manageexternal'] = 'Edit and manage external blogs'; $string['blog:manageofficialtags'] = 'Manage official tags'; $string['blog:managepersonaltags'] = 'Manage personal tags'; +$string['blog:search'] = 'Search blog entries'; $string['blog:view'] = 'View blog entries'; +$string['blog:viewdrafts'] = 'View draft blog entries'; $string['block:edit'] = 'Edit a block\'s settings'; $string['block:view'] = 'View block'; $string['calendar:manageentries'] = 'Manage any calendar entries'; @@ -57,6 +62,8 @@ $string['course:bulkmessaging'] = 'Send a message to many people'; $string['course:changefullname'] = 'Change course full name'; $string['course:changeshortname'] = 'Change course short name'; $string['course:changeidnumber'] = 'Change course ID number'; +$string['course:changecategory'] = 'Change course category'; +$string['course:changesummary'] = 'Change course summary'; $string['course:create'] = 'Create courses'; $string['course:delete'] = 'Delete courses'; $string['course:manageactivities'] = 'Manage activities'; diff --git a/lib/db/access.php b/lib/db/access.php index 9f389fd24b..304f629eae 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -700,6 +700,30 @@ $moodle_capabilities = array( ), 'clonepermissionsfrom' => 'moodle/course:update' ), + 'moodle/course:changecategory' => array( + 'riskbitmask' => RISK_XSS, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'legacy' => array( + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ), + 'clonepermissionsfrom' => 'moodle/course:update' + ), + + 'moodle/course:changesummary' => array( + 'riskbitmask' => RISK_XSS, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'legacy' => array( + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ), + 'clonepermissionsfrom' => 'moodle/course:update' + ), + 'moodle/site:viewparticipants' => array( diff --git a/version.php b/version.php index 875b0baceb..9b79d70d63 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2009091700; // YYYYMMDD = date of the last version bump + $version = 2009100200; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20091002)'; // Human-friendly version name -- 2.39.5