]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15262 Added a two capabilities to prevent certain users from changing a course...
authornicolasconnault <nicolasconnault>
Fri, 2 Oct 2009 07:05:02 +0000 (07:05 +0000)
committernicolasconnault <nicolasconnault>
Fri, 2 Oct 2009 07:05:02 +0000 (07:05 +0000)
course/edit_form.php
lang/en_utf8/role.php
lib/db/access.php
version.php

index d5ff0e68232031fe523b414f117c14364e0b3e5d..fc4a3ab5954e593293332a2b30e53197d20aab35 100644 (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) {
index ed5995df4b580a368b04d72fe6cb8eefcde3812b..f704ba894f452c45f40509d5efa287ea6a76b9db 100644 (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';
index 9f389fd24bdce389ea6d6c04b5dfb99f6f8eb769..304f629eaefa5f2a0c2acdde7db4c7bcb6cb2261 100644 (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(
 
index 875b0baceb6985dfaab2985e122889ca014fcb5c..9b79d70d63162c1c80c2f6a878eb7e6ffedb1596 100644 (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