MDL-15262 Added a two capabilities to prevent certain users from changing a course's fullname and shortname. merged from MOODLE_19_STABLE

This commit is contained in:
nicolasconnault
2009-10-02 07:05:02 +00:00
parent 3a8f4b907f
commit 50569ba3ac
4 changed files with 41 additions and 1 deletions
+9
View File
@@ -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) {
+7
View File
@@ -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';
+24
View File
@@ -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(
+1 -1
View File
@@ -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