MDL-21781 cohort capabilities
authorPetr Skoda <skodak@moodle.org>
Fri, 23 Apr 2010 09:05:56 +0000 (09:05 +0000)
committerPetr Skoda <skodak@moodle.org>
Fri, 23 Apr 2010 09:05:56 +0000 (09:05 +0000)
lib/db/access.php

index a79ccfb..8885aea 100644 (file)
@@ -470,6 +470,39 @@ $capabilities = array(
         'clonepermissionsfrom' => 'moodle/category:visibility'
     ),
 
+    // create, delete, move cohorts in system and course categories,
+    // (cohorts with component !== null can be only moved)
+    'moodle/cohort:manage' => array(
+
+        'captype' => 'write',
+        'contextlevel' => CONTEXT_COURSECAT,
+        'legacy' => array(
+            'manager' => CAP_ALLOW
+        )
+    ),
+
+    // add and remove cohort members (only for cohorts where component !== null)
+    'moodle/cohort:assign' => array(
+
+        'captype' => 'write',
+        'contextlevel' => CONTEXT_COURSECAT,
+        'legacy' => array(
+            'manager' => CAP_ALLOW
+        )
+    ),
+
+    // view members of a cohort, this can be used in course context too,
+    // this also controls the ability to actually use cohort
+    'moodle/cohort:view' => array(
+
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'editingteacher' => CAP_ALLOW,
+            'manager' => CAP_ALLOW
+        )
+    ),
+
     'moodle/course:create' => array(
 
         'riskbitmask' => RISK_XSS,