Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Plugin capabilities
  19   *
  20   * @package    mod_data
  21   * @copyright  2006 Martin Dougiamas
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  $capabilities = array(
  28  
  29      'mod/data:addinstance' => array(
  30          'riskbitmask' => RISK_XSS,
  31  
  32          'captype' => 'write',
  33          'contextlevel' => CONTEXT_COURSE,
  34          'archetypes' => array(
  35              'editingteacher' => CAP_ALLOW,
  36              'manager' => CAP_ALLOW
  37          ),
  38          'clonepermissionsfrom' => 'moodle/course:manageactivities'
  39      ),
  40  
  41      'mod/data:viewentry' => array(
  42  
  43          'captype' => 'read',
  44          'contextlevel' => CONTEXT_MODULE,
  45          'archetypes' => array(
  46              'frontpage' => CAP_ALLOW, // needed for databases on the frontpage
  47              'guest' => CAP_ALLOW,
  48              'student' => CAP_ALLOW,
  49              'teacher' => CAP_ALLOW,
  50              'editingteacher' => CAP_ALLOW,
  51              'manager' => CAP_ALLOW
  52          )
  53      ),
  54  
  55      'mod/data:writeentry' => array(
  56  
  57          'riskbitmask' => RISK_SPAM,
  58  
  59          'captype' => 'write',
  60          'contextlevel' => CONTEXT_MODULE,
  61          'archetypes' => array(
  62              'student' => CAP_ALLOW,
  63              'teacher' => CAP_ALLOW,
  64              'editingteacher' => CAP_ALLOW,
  65              'manager' => CAP_ALLOW
  66          )
  67      ),
  68  
  69      'mod/data:comment' => array(
  70  
  71          'riskbitmask' => RISK_SPAM,
  72  
  73          'captype' => 'write',
  74          'contextlevel' => CONTEXT_MODULE,
  75          'archetypes' => array(
  76              'student' => CAP_ALLOW,
  77              'teacher' => CAP_ALLOW,
  78              'editingteacher' => CAP_ALLOW,
  79              'manager' => CAP_ALLOW
  80          )
  81      ),
  82  
  83      'mod/data:rate' => array(
  84  
  85          'captype' => 'write',
  86          'contextlevel' => CONTEXT_MODULE,
  87          'archetypes' => array(
  88              'teacher' => CAP_ALLOW,
  89              'editingteacher' => CAP_ALLOW,
  90              'manager' => CAP_ALLOW
  91          )
  92      ),
  93  
  94      'mod/data:viewrating' => array(
  95  
  96          'captype' => 'read',
  97          'contextlevel' => CONTEXT_MODULE,
  98          'archetypes' => array(
  99              'teacher' => CAP_ALLOW,
 100              'editingteacher' => CAP_ALLOW,
 101              'manager' => CAP_ALLOW
 102          )
 103      ),
 104  
 105      'mod/data:viewanyrating' => array(
 106  
 107          'riskbitmask' => RISK_PERSONAL,
 108          'captype' => 'read',
 109          'contextlevel' => CONTEXT_MODULE,
 110          'archetypes' => array(
 111              'teacher' => CAP_ALLOW,
 112              'editingteacher' => CAP_ALLOW,
 113              'manager' => CAP_ALLOW
 114          ),
 115          'clonepermissionsfrom' =>  'mod/data:viewrating'
 116      ),
 117  
 118      'mod/data:viewallratings' => array(
 119  
 120          'riskbitmask' => RISK_PERSONAL,
 121          'captype' => 'read',
 122          'contextlevel' => CONTEXT_MODULE,
 123          'archetypes' => array(
 124              'teacher' => CAP_ALLOW,
 125              'editingteacher' => CAP_ALLOW,
 126              'manager' => CAP_ALLOW
 127          ),
 128          'clonepermissionsfrom' =>  'mod/data:viewrating'
 129      ),
 130  
 131      'mod/data:approve' => array(
 132  
 133          'riskbitmask' => RISK_SPAM,
 134  
 135          'captype' => 'write',
 136          'contextlevel' => CONTEXT_MODULE,
 137          'archetypes' => array(
 138              'teacher' => CAP_ALLOW,
 139              'editingteacher' => CAP_ALLOW,
 140              'manager' => CAP_ALLOW
 141          )
 142      ),
 143  
 144      'mod/data:manageentries' => array(
 145  
 146          'riskbitmask' => RISK_SPAM,
 147  
 148          'captype' => 'write',
 149          'contextlevel' => CONTEXT_MODULE,
 150          'archetypes' => array(
 151              'teacher' => CAP_ALLOW,
 152              'editingteacher' => CAP_ALLOW,
 153              'manager' => CAP_ALLOW
 154          )
 155      ),
 156  
 157      'mod/data:managecomments' => array(
 158  
 159          'riskbitmask' => RISK_SPAM,
 160  
 161          'captype' => 'write',
 162          'contextlevel' => CONTEXT_MODULE,
 163          'archetypes' => array(
 164              'teacher' => CAP_ALLOW,
 165              'editingteacher' => CAP_ALLOW,
 166              'manager' => CAP_ALLOW
 167          )
 168      ),
 169  
 170      'mod/data:managetemplates' => array(
 171  
 172          'riskbitmask' => RISK_SPAM | RISK_XSS,
 173  
 174          'captype' => 'write',
 175          'contextlevel' => CONTEXT_MODULE,
 176          'archetypes' => array(
 177              'editingteacher' => CAP_ALLOW,
 178              'manager' => CAP_ALLOW
 179          )
 180      ),
 181  
 182      'mod/data:viewalluserpresets' => array(
 183  
 184          'captype' => 'read',
 185          'contextlevel' => CONTEXT_MODULE,
 186          'archetypes' => array(
 187              'teacher' => CAP_ALLOW,
 188              'editingteacher' => CAP_ALLOW,
 189              'manager' => CAP_ALLOW
 190          )
 191      ),
 192  
 193      'mod/data:manageuserpresets' => array(
 194  
 195          'riskbitmask' => RISK_SPAM | RISK_XSS,
 196  
 197          'captype' => 'write',
 198          'contextlevel' => CONTEXT_MODULE,
 199          'archetypes' => array(
 200              'manager' => CAP_ALLOW
 201          )
 202      ),
 203  
 204      'mod/data:exportentry' => array(
 205  
 206          'riskbitmask' => RISK_PERSONAL,
 207  
 208          'captype' => 'read',
 209          'contextlevel' => CONTEXT_MODULE,
 210          'archetypes' => array(
 211              'manager' => CAP_ALLOW,
 212              'teacher' => CAP_ALLOW,
 213              'editingteacher' => CAP_ALLOW,
 214          )
 215      ),
 216  
 217      'mod/data:exportownentry' => array(
 218  
 219          'captype' => 'read',
 220          'contextlevel' => CONTEXT_MODULE,
 221          'archetypes' => array(
 222              'manager' => CAP_ALLOW,
 223              'teacher' => CAP_ALLOW,
 224              'editingteacher' => CAP_ALLOW,
 225              'student' => CAP_ALLOW,
 226          )
 227      ),
 228  
 229      'mod/data:exportallentries' => array(
 230  
 231          'riskbitmask' => RISK_PERSONAL,
 232  
 233          'captype' => 'read',
 234          'contextlevel' => CONTEXT_MODULE,
 235          'archetypes' => array(
 236              'manager' => CAP_ALLOW,
 237              'teacher' => CAP_ALLOW,
 238              'editingteacher' => CAP_ALLOW,
 239          )
 240      ),
 241  
 242      'mod/data:exportuserinfo' => array(
 243  
 244          'riskbitmask' => RISK_PERSONAL,
 245  
 246          'captype' => 'read',
 247          'contextlevel' => CONTEXT_MODULE,
 248          'archetypes' => array(
 249              'manager' => CAP_ALLOW,
 250              'teacher' => CAP_ALLOW,
 251              'editingteacher' => CAP_ALLOW,
 252          )
 253      ),
 254  
 255      'mod/data:view' => array(
 256          'captype' => 'read',
 257          'contextlevel' => CONTEXT_MODULE,
 258          'archetypes' => array(
 259              'guest' => CAP_ALLOW,
 260              'student' => CAP_ALLOW,
 261              'teacher' => CAP_ALLOW,
 262              'editingteacher' => CAP_ALLOW,
 263              'manager' => CAP_ALLOW
 264          )
 265      )
 266  );
 267  
 268