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.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

   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   * This file contains the capabilities used by the lti module
  19   *
  20   * @package    mod_lti
  21   * @copyright  2009 Marc Alier, Jordi Piguillem, Nikolas Galanis, marc.alier@upc.edu
  22   * @copyright  2009 Universitat Politecnica de Catalunya http://www.upc.edu
  23   * @author     Marc Alier
  24   * @author     Jordi Piguillem
  25   * @author     Nikolas Galanis
  26   * @author     Chris Scribner
  27   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  28   */
  29  
  30  defined('MOODLE_INTERNAL') || die;
  31  
  32  $capabilities = array(
  33  
  34      // Whether the user can see the link to the external tool and follow it.
  35      'mod/lti:view' => array(
  36          'captype' => 'read',
  37          'contextlevel' => CONTEXT_MODULE,
  38          'archetypes' => array(
  39              'student' => CAP_ALLOW,
  40              'teacher' => CAP_ALLOW,
  41              'editingteacher' => CAP_ALLOW,
  42              'manager' => CAP_ALLOW
  43          )
  44      ),
  45  
  46      // Add an External tool activity to a course.
  47      'mod/lti:addinstance' => array(
  48          'riskbitmask' => RISK_XSS,
  49  
  50          'captype' => 'write',
  51          'contextlevel' => CONTEXT_COURSE,
  52          'archetypes' => array(
  53              'editingteacher' => CAP_ALLOW,
  54              'manager' => CAP_ALLOW
  55          ),
  56          'clonepermissionsfrom' => 'moodle/course:manageactivities'
  57      ),
  58  
  59      // When the user arrives at the external tool, if they have this capability
  60      // in Moodle, then they are given the Instructor role in the remote system,
  61      // otherwise they are given Learner. See the lti_get_ims_role function.
  62      'mod/lti:manage' => array(
  63          'riskbitmask' => RISK_PERSONAL, // A bit of a guess, but seems likely.
  64  
  65          'captype' => 'write',
  66          'contextlevel' => CONTEXT_MODULE,
  67          'archetypes' => array(
  68              'teacher' => CAP_ALLOW,
  69              'editingteacher' => CAP_ALLOW,
  70              'manager' => CAP_ALLOW
  71          )
  72      ),
  73  
  74      // When the user arrives at the external tool, if they have this capability
  75      // in Moodle, then they are given the Administrator role in the remote system,
  76      // otherwise they are given Learner. See the lti_get_ims_role function.
  77      'mod/lti:admin' => array(
  78          'riskbitmask' => RISK_PERSONAL, // A bit of a guess, but seems likely.
  79  
  80          'captype' => 'write',
  81          'contextlevel' => CONTEXT_MODULE
  82      ),
  83  
  84      // The ability to create or edit tool configurations for particular courses.
  85      'mod/lti:addcoursetool' => array(
  86          'captype' => 'write',
  87          'contextlevel' => CONTEXT_COURSE,
  88          'archetypes' => array(
  89              'editingteacher' => CAP_ALLOW,
  90              'manager' => CAP_ALLOW
  91          )
  92      ),
  93  
  94      // The ability to a preconfigured instance to the course.
  95      'mod/lti:addpreconfiguredinstance' => array(
  96          'captype' => 'write',
  97          'contextlevel' => CONTEXT_COURSE,
  98          'archetypes' => array(
  99              'editingteacher' => CAP_ALLOW,
 100              'manager' => CAP_ALLOW
 101          ),
 102          'clonepermissionsfrom' => 'mod/lti:addinstance',
 103      ),
 104  
 105      // The ability to request the administrator to configure a particular
 106      // External tool globally.
 107      'mod/lti:requesttooladd' => array(
 108          'captype' => 'write',
 109          'contextlevel' => CONTEXT_COURSE,
 110          'archetypes' => array(
 111              'editingteacher' => CAP_ALLOW,
 112              'manager' => CAP_ALLOW
 113          )
 114      )
 115  );
 116  $deprecatedcapabilities = [
 117      // The ability to add a manual instance (i.e. not from a preconfigured tool) to the course.
 118      'mod/lti:addmanualinstance' => [
 119          'message' => 'Manual instance configuration is deprecated. Please create a course tool (mod/lti:addcoursetool) and ensure '.
 120              'users are able to add an instance of the course tool via the activity chooser (mod/lti:addpreconfiguredinstance).'
 121      ],
 122  ];