Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   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 workshop module
  19   *
  20   * @package    mod_workshop
  21   * @copyright  2009 David Mudrak <david.mudrak@gmail.com>
  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      // Ability to see that the workshop exists, and the basic information
  30      // about it, for example the intro field
  31      'mod/workshop:view' => array(
  32          'captype' => 'read',
  33          'contextlevel' => CONTEXT_MODULE,
  34          'archetypes' => array(
  35              'guest' => CAP_ALLOW,
  36              'student' => CAP_ALLOW,
  37              'teacher' => CAP_ALLOW,
  38              'editingteacher' => CAP_ALLOW,
  39              'manager' => CAP_ALLOW
  40          )
  41      ),
  42  
  43      // Ability to add a new workshop to the course.
  44      'mod/workshop:addinstance' => array(
  45          'riskbitmask' => RISK_XSS,
  46  
  47          'captype' => 'write',
  48          'contextlevel' => CONTEXT_COURSE,
  49          'archetypes' => array(
  50              'editingteacher' => CAP_ALLOW,
  51              'manager' => CAP_ALLOW
  52          ),
  53          'clonepermissionsfrom' => 'moodle/course:manageactivities'
  54      ),
  55  
  56      // Ability to change the current phase (stage) of the workshop, for example
  57      // allow submitting, start assessment period, close workshop etc.
  58      'mod/workshop:switchphase' => array(
  59          'captype' => 'write',
  60          'contextlevel' => CONTEXT_MODULE,
  61          'archetypes' => array(
  62              'teacher' => CAP_ALLOW,
  63              'editingteacher' => CAP_ALLOW,
  64              'manager' => CAP_ALLOW
  65          )
  66      ),
  67  
  68      // Ability to modify the assessment forms, gives access to editform.php
  69      'mod/workshop:editdimensions' => array(
  70          'riskbitmask' => RISK_XSS,              // can embed flash and javascript into wysiwyg
  71          'captype' => 'write',
  72          'contextlevel' => CONTEXT_MODULE,
  73          'archetypes' => array(
  74              'editingteacher' => CAP_ALLOW,
  75              'manager' => CAP_ALLOW
  76          )
  77      ),
  78  
  79      // Ability to submit own work. All users having this capability are expected to participate
  80      // in the workshop as the authors
  81      'mod/workshop:submit' => array(
  82          'captype' => 'write',
  83          'contextlevel' => CONTEXT_MODULE,
  84          'archetypes' => array(
  85              'student' => CAP_ALLOW,
  86          )
  87      ),
  88  
  89      // Ability to be a reviewer of a submission. All users with this capability are considered
  90      // as potential reviewers for the allocation purposes and can train assessment process on the
  91      // example submissions.
  92      'mod/workshop:peerassess' => array(
  93          'captype' => 'write',
  94          'contextlevel' => CONTEXT_MODULE,
  95          'archetypes' => array(
  96              'student' => CAP_ALLOW,
  97          )
  98      ),
  99  
 100  
 101      // Ability to submit and referentially assess the examples and to see all other
 102      // assessments of these examples
 103      'mod/workshop:manageexamples' => array(
 104          'captype' => 'write',
 105          'contextlevel' => CONTEXT_MODULE,
 106          'archetypes' => array(
 107              'teacher' => CAP_ALLOW,
 108              'editingteacher' => CAP_ALLOW,
 109              'manager' => CAP_ALLOW
 110          )
 111      ),
 112  
 113      // Ability to allocate (assign) a submission for a review
 114      'mod/workshop:allocate' => array(
 115          'captype' => 'write',
 116          'contextlevel' => CONTEXT_MODULE,
 117          'archetypes' => array(
 118              'teacher' => CAP_ALLOW,
 119              'editingteacher' => CAP_ALLOW,
 120              'manager' => CAP_ALLOW
 121          )
 122      ),
 123  
 124      // Ability to publish submissions, i.e. make them available when workshop is closed
 125      'mod/workshop:publishsubmissions' => array(
 126          'captype' => 'write',
 127          'contextlevel' => CONTEXT_MODULE,
 128          'archetypes' => array(
 129              'teacher' => CAP_ALLOW,
 130              'editingteacher' => CAP_ALLOW,
 131              'manager' => CAP_ALLOW
 132          )
 133      ),
 134  
 135      // Ability to identify the author of the work that has been allocated to them for a review
 136      // Reviewers without this capability will see the author as Anonymous
 137      'mod/workshop:viewauthornames' => array(
 138          'captype' => 'read',
 139          'contextlevel' => CONTEXT_MODULE,
 140          'archetypes' => array(
 141              'student' => CAP_ALLOW,
 142              'teacher' => CAP_ALLOW,
 143              'editingteacher' => CAP_ALLOW,
 144              'manager' => CAP_ALLOW
 145          )
 146      ),
 147  
 148      // Ability to identify the reviewer of the given submission (i.e. the owner of the assessment)
 149      'mod/workshop:viewreviewernames' => array(
 150          'captype' => 'read',
 151          'contextlevel' => CONTEXT_MODULE,
 152          'archetypes' => array(
 153              'teacher' => CAP_ALLOW,
 154              'editingteacher' => CAP_ALLOW,
 155              'manager' => CAP_ALLOW
 156          )
 157      ),
 158  
 159      // Ability to view the work submitted by an other user. In separate groups mode,
 160      // the user has to be allowed to access all groups or be the member of the
 161      // submission author's group.
 162      'mod/workshop:viewallsubmissions' => array(
 163          'captype' => 'read',
 164          'contextlevel' => CONTEXT_MODULE,
 165          'archetypes' => array(
 166              'teacher' => CAP_ALLOW,
 167              'editingteacher' => CAP_ALLOW,
 168              'manager' => CAP_ALLOW
 169          )
 170      ),
 171  
 172      // Ability to view published submission when the workshop is closed. Group mode
 173      // restrictions do not apply here, published submissions are available in all
 174      // groups even in the separate groups mode.
 175      'mod/workshop:viewpublishedsubmissions' => array(
 176          'captype' => 'read',
 177          'contextlevel' => CONTEXT_MODULE,
 178          'archetypes' => array(
 179              'student' => CAP_ALLOW,
 180              'teacher' => CAP_ALLOW,
 181              'editingteacher' => CAP_ALLOW,
 182              'manager' => CAP_ALLOW
 183          )
 184      ),
 185  
 186      // Ability to view the authors of published submissions.
 187      'mod/workshop:viewauthorpublished' => array(
 188          'captype' => 'read',
 189          'contextlevel' => CONTEXT_MODULE,
 190          'archetypes' => array(
 191              'student' => CAP_ALLOW,
 192              'teacher' => CAP_ALLOW,
 193              'editingteacher' => CAP_ALLOW,
 194              'manager' => CAP_ALLOW
 195          )
 196      ),
 197  
 198      // Ability to always view the assessments of other users' work and the calculated grades,
 199      // regardless the phase. The separate groups membership is checked against the submission
 200      // author only, not against the reviewer. In other words, if the user has this capability
 201      // and is allowed to see some submission, then they are implicitly allowed to see all
 202      // assessments of that submissions even if they do not share a group with the reviewer.
 203      'mod/workshop:viewallassessments' => array(
 204          'captype' => 'read',
 205          'contextlevel' => CONTEXT_MODULE,
 206          'archetypes' => array(
 207              'teacher' => CAP_ALLOW,
 208              'editingteacher' => CAP_ALLOW,
 209              'manager' => CAP_ALLOW
 210          )
 211      ),
 212  
 213      // Ability to override grade for submission or the calculated grades for assessment
 214      // and to run aggregation tasks that computes the total grade
 215      'mod/workshop:overridegrades' => array(
 216          'captype' => 'write',
 217          'contextlevel' => CONTEXT_MODULE,
 218          'archetypes' => array(
 219              'teacher' => CAP_ALLOW,
 220              'editingteacher' => CAP_ALLOW,
 221              'manager' => CAP_ALLOW
 222          )
 223      ),
 224  
 225      // Ability to ignore time restrictions (submission start/end time and assessment
 226      // start/end time) if they are defined
 227      'mod/workshop:ignoredeadlines' => array(
 228          'captype' => 'write',
 229          'contextlevel' => CONTEXT_MODULE,
 230          'archetypes' => array(
 231              'teacher' => CAP_ALLOW,
 232              'editingteacher' => CAP_ALLOW,
 233              'manager' => CAP_ALLOW
 234          )
 235      ),
 236  
 237      // Ability to delete other users' submissions.
 238      'mod/workshop:deletesubmissions' => array(
 239          'captype' => 'write',
 240          'contextlevel' => CONTEXT_MODULE,
 241          'archetypes' => array(
 242              'teacher' => CAP_ALLOW,
 243              'editingteacher' => CAP_ALLOW,
 244              'manager' => CAP_ALLOW
 245          )
 246      ),
 247  
 248      // Ability to export submissions to a portfolio. Applies to all submissions
 249      // the user has access to.
 250      'mod/workshop:exportsubmissions' => array(
 251          'captype' => 'read',
 252          'contextlevel' => CONTEXT_MODULE,
 253          'archetypes' => array(
 254              'manager' => CAP_ALLOW,
 255              'teacher' => CAP_ALLOW,
 256              'editingteacher' => CAP_ALLOW,
 257              'student' => CAP_ALLOW,
 258          )
 259      ),
 260  );