Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.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   * Capability definitions for the lesson module.
  19   *
  20   * For naming conventions, see lib/db/access.php.
  21   *
  22   * @package    mod_lesson
  23   * @copyright  1999 onwards Martin Dougiamas  {@link http://moodle.com}
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or late
  25   */
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  $capabilities = array(
  30  
  31      'mod/lesson:addinstance' => array(
  32          'riskbitmask' => RISK_XSS,
  33  
  34          'captype' => 'write',
  35          'contextlevel' => CONTEXT_COURSE,
  36          'archetypes' => array(
  37              'editingteacher' => CAP_ALLOW,
  38              'manager' => CAP_ALLOW
  39          ),
  40          'clonepermissionsfrom' => 'moodle/course:manageactivities'
  41      ),
  42  
  43      'mod/lesson:edit' => array(
  44  
  45          'riskbitmask' => RISK_XSS, // we want flash and JS in question pages
  46  
  47          'captype' => 'write',
  48          'contextlevel' => CONTEXT_MODULE,
  49          'archetypes' => array(
  50              'editingteacher' => CAP_ALLOW,
  51              'manager' => CAP_ALLOW
  52          )
  53      ),
  54  
  55      // Grade essay questions.
  56      'mod/lesson:grade' => array(
  57          'riskbitmask' => RISK_SPAM | RISK_XSS,
  58          'captype' => 'write',
  59          'contextlevel' => CONTEXT_MODULE,
  60          'archetypes' => array(
  61              'teacher' => CAP_ALLOW,
  62              'editingteacher' => CAP_ALLOW,
  63              'manager' => CAP_ALLOW
  64          )
  65      ),
  66  
  67      // View the lesson reports.
  68      'mod/lesson:viewreports' => array(
  69          'riskbitmask' => RISK_PERSONAL,
  70          'captype' => 'read',
  71          'contextlevel' => CONTEXT_MODULE,
  72          'archetypes' => array(
  73              'teacher' => CAP_ALLOW,
  74              'editingteacher' => CAP_ALLOW,
  75              'manager' => CAP_ALLOW
  76          )
  77      ),
  78  
  79      'mod/lesson:manage' => array(
  80  
  81          'captype' => 'write',
  82          'contextlevel' => CONTEXT_MODULE,
  83          'archetypes' => array(
  84              'teacher' => CAP_ALLOW,
  85              'editingteacher' => CAP_ALLOW,
  86              'manager' => CAP_ALLOW
  87          )
  88      ),
  89  
  90      // Edit the lesson overrides.
  91      'mod/lesson:manageoverrides' => array(
  92          'captype' => 'write',
  93          'contextlevel' => CONTEXT_MODULE,
  94          'archetypes' => array(
  95              'editingteacher' => CAP_ALLOW,
  96              'manager' => CAP_ALLOW
  97          )
  98      ),
  99  
 100      'mod/lesson:view' => array(
 101          'captype' => 'read',
 102          'contextlevel' => CONTEXT_MODULE,
 103          'archetypes' => array(
 104              'user' => CAP_ALLOW,
 105              'guest' => CAP_ALLOW
 106          )
 107      ),
 108  );