Merge branch 'wip-mdl-31969' of git://github.com/rajeshtaneja/moodle
[moodle.git] / lib / db / access.php
index dd2d31f..9659b46 100644 (file)
@@ -1888,5 +1888,148 @@ $capabilities = array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
+    ),
+
+    // Badges.
+    'moodle/badges:manageglobalsettings' => array(
+        'riskbitmask'  => RISK_DATALOSS | RISK_CONFIG,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'       => CAP_ALLOW,
+            'student'       => CAP_PREVENT
+        )
+    ),
+
+    // View available badges without earning them.
+    'moodle/badges:viewbadges' => array(
+        'captype'       => 'read',
+        'contextlevel'  => CONTEXT_SYSTEM,
+        'archetypes'    => array(
+            'manager'       => CAP_ALLOW,
+            'user'          => CAP_ALLOW,
+            'student'       => CAP_ALLOW
+        )
+    ),
+
+    // Manage badges on own private badges page.
+    'moodle/badges:manageownbadges' => array(
+        'riskbitmap'    => RISK_SPAM | RISK_PERSONAL,
+        'captype'       => 'write',
+        'contextlevel'  => CONTEXT_SYSTEM,
+        'archetypes'    => array(
+            'user'    => CAP_ALLOW
+        )
+    ),
+
+    // View public badges in other users' profiles.
+    'moodle/badges:viewotherbadges' => array(
+        'riskbitmap'    => RISK_PERSONAL,
+        'captype'       => 'read',
+        'contextlevel'  => CONTEXT_USER,
+        'archetypes'    => array(
+            'user'    => CAP_ALLOW
+        )
+    ),
+
+    // Earn badge.
+    'moodle/badges:earnbadge' => array(
+        'captype'       => 'write',
+        'contextlevel'  => CONTEXT_SYSTEM,
+        'archetypes'    => array(
+            'user'           => CAP_ALLOW,
+            'student'        => CAP_ALLOW,
+        )
+    ),
+
+    // Create/duplicate badges.
+    'moodle/badges:createbadge' => array(
+        'riskbitmask'  => RISK_CONFIG | RISK_SPAM,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'        => CAP_ALLOW,
+            'coursecreator'  => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'student'        => CAP_PREVENT
+        )
+    ),
+
+    // Delete badges.
+    'moodle/badges:deletebadge' => array(
+        'riskbitmask'  => RISK_CONFIG | RISK_DATALOSS,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'        => CAP_ALLOW,
+            'coursecreator'  => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'student'        => CAP_PREVENT
+        )
+    ),
+
+    // Set up/edit badge details.
+    'moodle/badges:configuredetails' => array(
+        'riskbitmask'  => RISK_CONFIG,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'        => CAP_ALLOW,
+            'coursecreator'  => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'student'        => CAP_PREVENT
+        )
+    ),
+
+    // Set up/edit criteria of earning a badge.
+    'moodle/badges:configurecriteria' => array(
+        'riskbitmask'  => RISK_CONFIG,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'        => CAP_ALLOW,
+            'coursecreator'  => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'student'        => CAP_PREVENT
+        )
+    ),
+
+    // Configure badge messages.
+    'moodle/badges:configuremessages' => array(
+        'riskbitmask'  => RISK_CONFIG,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'        => CAP_ALLOW,
+            'coursecreator'  => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'student'        => CAP_PREVENT
+        )
+    ),
+
+    // Award badge to a user.
+    'moodle/badges:awardbadge' => array(
+        'riskbitmask'  => RISK_SPAM,
+        'captype'      => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+            'manager'        => CAP_ALLOW,
+            'coursecreator'  => CAP_ALLOW,
+            'teacher'        => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'student'        => CAP_PREVENT
+        )
+    ),
+
+    // View users who earned a specific badge without being able to award a badge.
+    'moodle/badges:viewawarded' => array(
+        'riskbitmask'  => RISK_PERSONAL,
+        'captype'      => 'read',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'archetypes'   => array(
+                'manager'        => CAP_ALLOW,
+                'teacher'        => CAP_ALLOW,
+                'editingteacher' => CAP_ALLOW,
+        )
     )
 );
     )
 );