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

View File

@ -71,6 +71,11 @@ class course_edit_form extends moodleform {
$mform->setDefault('category', $category->id); $mform->setDefault('category', $category->id);
$mform->setType('category', PARAM_INT); $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'); $fullname = get_string('defaultcoursefullname');
$shortname = get_string('defaultcourseshortname'); $shortname = get_string('defaultcourseshortname');
while ($DB->record_exists('course', array('fullname'=>$fullname)) 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->setHelpButton('summary', array('text2', get_string('helptext')), true);
$mform->setType('summary', PARAM_RAW); $mform->setType('summary', PARAM_RAW);
if ($course and !has_capability('moodle/course:changesummary', $coursecontext)) {
$mform->hardFreeze('summary');
}
$courseformats = get_plugin_list('format'); $courseformats = get_plugin_list('format');
$formcourseformats = array(); $formcourseformats = array();
foreach ($courseformats as $courseformat => $formatdir) { foreach ($courseformats as $courseformat => $formatdir) {

View File

@ -24,11 +24,16 @@ $string['assignglobalroles'] = 'Assign system roles';
$string['assignmentcontext'] = 'Assignment context'; $string['assignmentcontext'] = 'Assignment context';
$string['assignmentoptions'] = 'Assignment options'; $string['assignmentoptions'] = 'Assignment options';
$string['backtoallroles'] = 'Back to the list of all roles'; $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:create'] = 'Create new blog entries';
$string['blog:manageentries'] = 'Edit and manage entries'; $string['blog:manageentries'] = 'Edit and manage entries';
$string['blog:manageexternal'] = 'Edit and manage external blogs';
$string['blog:manageofficialtags'] = 'Manage official tags'; $string['blog:manageofficialtags'] = 'Manage official tags';
$string['blog:managepersonaltags'] = 'Manage personal tags'; $string['blog:managepersonaltags'] = 'Manage personal tags';
$string['blog:search'] = 'Search blog entries';
$string['blog:view'] = 'View 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:edit'] = 'Edit a block\'s settings';
$string['block:view'] = 'View block'; $string['block:view'] = 'View block';
$string['calendar:manageentries'] = 'Manage any calendar entries'; $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:changefullname'] = 'Change course full name';
$string['course:changeshortname'] = 'Change course short name'; $string['course:changeshortname'] = 'Change course short name';
$string['course:changeidnumber'] = 'Change course ID number'; $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:create'] = 'Create courses';
$string['course:delete'] = 'Delete courses'; $string['course:delete'] = 'Delete courses';
$string['course:manageactivities'] = 'Manage activities'; $string['course:manageactivities'] = 'Manage activities';

View File

@ -700,6 +700,30 @@ $moodle_capabilities = array(
), ),
'clonepermissionsfrom' => 'moodle/course:update' '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( 'moodle/site:viewparticipants' => array(

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine // This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php) // 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 // XX = daily increments
$release = '2.0 dev (Build: 20091002)'; // Human-friendly version name $release = '2.0 dev (Build: 20091002)'; // Human-friendly version name