Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 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   * Plugin capabilities
  19   *
  20   * @package    mod_forum
  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/forum: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/forum:viewdiscussion' => array(
  42  
  43          'captype' => 'read',
  44          'contextlevel' => CONTEXT_MODULE,
  45          'archetypes' => array(
  46              'frontpage' => CAP_ALLOW, // needed especially for news 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/forum:viewhiddentimedposts' => array(
  56  
  57          'captype' => 'read',
  58          'contextlevel' => CONTEXT_MODULE,
  59          'archetypes' => array(
  60              'teacher' => CAP_ALLOW,
  61              'editingteacher' => CAP_ALLOW,
  62              'manager' => CAP_ALLOW
  63          )
  64      ),
  65  
  66      'mod/forum:startdiscussion' => array(
  67  
  68          'riskbitmask' => RISK_SPAM,
  69  
  70          'captype' => 'write',
  71          'contextlevel' => CONTEXT_MODULE,
  72          'archetypes' => array(
  73              'student' => CAP_ALLOW,
  74              'teacher' => CAP_ALLOW,
  75              'editingteacher' => CAP_ALLOW,
  76              'manager' => CAP_ALLOW
  77          )
  78      ),
  79  
  80      'mod/forum:replypost' => array(
  81  
  82          'riskbitmask' => RISK_SPAM,
  83  
  84          'captype' => 'write',
  85          'contextlevel' => CONTEXT_MODULE,
  86          'archetypes' => array(
  87              'student' => CAP_ALLOW,
  88              'teacher' => CAP_ALLOW,
  89              'editingteacher' => CAP_ALLOW,
  90              'manager' => CAP_ALLOW
  91          )
  92      ),
  93  
  94      'mod/forum:addnews' => array(
  95  
  96          'riskbitmask' => RISK_SPAM,
  97  
  98          'captype' => 'write',
  99          'contextlevel' => CONTEXT_MODULE,
 100          'archetypes' => array(
 101              'teacher' => CAP_ALLOW,
 102              'editingteacher' => CAP_ALLOW,
 103              'manager' => CAP_ALLOW
 104          )
 105      ),
 106  
 107      'mod/forum:replynews' => array(
 108  
 109          'riskbitmask' => RISK_SPAM,
 110  
 111          'captype' => 'write',
 112          'contextlevel' => CONTEXT_MODULE,
 113          'archetypes' => array(
 114              'teacher' => CAP_ALLOW,
 115              'editingteacher' => CAP_ALLOW,
 116              'manager' => CAP_ALLOW
 117          )
 118      ),
 119  
 120      'mod/forum:viewrating' => array(
 121  
 122          'captype' => 'read',
 123          'contextlevel' => CONTEXT_MODULE,
 124          'archetypes' => array(
 125              'student' => CAP_ALLOW,
 126              'teacher' => CAP_ALLOW,
 127              'editingteacher' => CAP_ALLOW,
 128              'manager' => CAP_ALLOW
 129          )
 130      ),
 131  
 132      'mod/forum:viewanyrating' => array(
 133  
 134          'riskbitmask' => RISK_PERSONAL,
 135          'captype' => 'read',
 136          'contextlevel' => CONTEXT_MODULE,
 137          'archetypes' => array(
 138              'teacher' => CAP_ALLOW,
 139              'editingteacher' => CAP_ALLOW,
 140              'manager' => CAP_ALLOW
 141          )
 142      ),
 143  
 144      'mod/forum:viewallratings' => array(
 145  
 146          'riskbitmask' => RISK_PERSONAL,
 147          'captype' => 'read',
 148          'contextlevel' => CONTEXT_MODULE,
 149          'archetypes' => array(
 150              'teacher' => CAP_ALLOW,
 151              'editingteacher' => CAP_ALLOW,
 152              'manager' => CAP_ALLOW
 153          ),
 154          'clonepermissionsfrom' =>  'mod/forum:viewanyrating'
 155      ),
 156  
 157      'mod/forum:rate' => array(
 158  
 159          'captype' => 'write',
 160          'contextlevel' => CONTEXT_MODULE,
 161          'archetypes' => array(
 162              'teacher' => CAP_ALLOW,
 163              'editingteacher' => CAP_ALLOW,
 164              'manager' => CAP_ALLOW
 165          )
 166      ),
 167  
 168      'mod/forum:postprivatereply' => array(
 169          'captype' => 'write',
 170          'contextlevel' => CONTEXT_MODULE,
 171          'archetypes' => array(
 172              'teacher' => CAP_ALLOW,
 173              'editingteacher' => CAP_ALLOW,
 174              'manager' => CAP_ALLOW
 175          )
 176      ),
 177  
 178      'mod/forum:readprivatereplies' => array(
 179          'captype' => 'read',
 180          'contextlevel' => CONTEXT_MODULE,
 181          'archetypes' => array(
 182              'teacher' => CAP_ALLOW,
 183              'editingteacher' => CAP_ALLOW,
 184              'manager' => CAP_ALLOW
 185          )
 186      ),
 187  
 188      'mod/forum:createattachment' => array(
 189  
 190          'riskbitmask' => RISK_SPAM,
 191  
 192          'captype' => 'write',
 193          'contextlevel' => CONTEXT_MODULE,
 194          'archetypes' => array(
 195              'student' => CAP_ALLOW,
 196              'teacher' => CAP_ALLOW,
 197              'editingteacher' => CAP_ALLOW,
 198              'manager' => CAP_ALLOW
 199          )
 200      ),
 201  
 202      'mod/forum:deleteownpost' => array(
 203  
 204          'captype' => 'write',
 205          'contextlevel' => CONTEXT_MODULE,
 206          'archetypes' => array(
 207              'student' => CAP_ALLOW,
 208              'teacher' => CAP_ALLOW,
 209              'editingteacher' => CAP_ALLOW,
 210              'manager' => CAP_ALLOW
 211          )
 212      ),
 213  
 214      'mod/forum:deleteanypost' => array(
 215  
 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      'mod/forum:splitdiscussions' => array(
 226  
 227          'captype' => 'write',
 228          'contextlevel' => CONTEXT_MODULE,
 229          'archetypes' => array(
 230              'teacher' => CAP_ALLOW,
 231              'editingteacher' => CAP_ALLOW,
 232              'manager' => CAP_ALLOW
 233          )
 234      ),
 235  
 236      'mod/forum:movediscussions' => array(
 237  
 238          'captype' => 'write',
 239          'contextlevel' => CONTEXT_MODULE,
 240          'archetypes' => array(
 241              'teacher' => CAP_ALLOW,
 242              'editingteacher' => CAP_ALLOW,
 243              'manager' => CAP_ALLOW
 244          )
 245      ),
 246  
 247      'mod/forum:pindiscussions' => array(
 248  
 249          'captype' => 'write',
 250          'contextlevel' => CONTEXT_MODULE,
 251          'archetypes' => array(
 252              'teacher' => CAP_ALLOW,
 253              'editingteacher' => CAP_ALLOW,
 254              'manager' => CAP_ALLOW
 255          )
 256      ),
 257  
 258      'mod/forum:editanypost' => array(
 259  
 260          'riskbitmask' => RISK_SPAM,
 261  
 262          'captype' => 'write',
 263          'contextlevel' => CONTEXT_MODULE,
 264          'archetypes' => array(
 265              'teacher' => CAP_ALLOW,
 266              'editingteacher' => CAP_ALLOW,
 267              'manager' => CAP_ALLOW
 268          )
 269      ),
 270  
 271      'mod/forum:viewqandawithoutposting' => array(
 272  
 273          'captype' => 'read',
 274          'contextlevel' => CONTEXT_MODULE,
 275          'archetypes' => array(
 276              'teacher' => CAP_ALLOW,
 277              'editingteacher' => CAP_ALLOW,
 278              'manager' => CAP_ALLOW
 279          )
 280      ),
 281  
 282      'mod/forum:viewsubscribers' => array(
 283  
 284          'captype' => 'read',
 285          'contextlevel' => CONTEXT_MODULE,
 286          'archetypes' => array(
 287              'teacher' => CAP_ALLOW,
 288              'editingteacher' => CAP_ALLOW,
 289              'manager' => CAP_ALLOW
 290          )
 291      ),
 292  
 293      'mod/forum:managesubscriptions' => array(
 294  
 295          'riskbitmask' => RISK_SPAM,
 296  
 297          'captype' => 'write',
 298          'contextlevel' => CONTEXT_MODULE,
 299          'archetypes' => array(
 300              'teacher' => CAP_ALLOW,
 301              'editingteacher' => CAP_ALLOW,
 302              'manager' => CAP_ALLOW
 303          )
 304      ),
 305  
 306      'mod/forum:postwithoutthrottling' => array(
 307  
 308          'riskbitmask' => RISK_SPAM,
 309  
 310          'captype' => 'write',
 311          'contextlevel' => CONTEXT_MODULE,
 312          'archetypes' => array(
 313              'teacher' => CAP_ALLOW,
 314              'editingteacher' => CAP_ALLOW,
 315              'manager' => CAP_ALLOW
 316          )
 317      ),
 318  
 319      'mod/forum:exportdiscussion' => array(
 320  
 321          'riskbitmask' => RISK_PERSONAL,
 322  
 323          'captype' => 'read',
 324          'contextlevel' => CONTEXT_MODULE,
 325          'archetypes' => array(
 326              'teacher' => CAP_ALLOW,
 327              'editingteacher' => CAP_ALLOW,
 328              'manager' => CAP_ALLOW
 329          )
 330      ),
 331      'mod/forum:exportforum' => array(
 332          'riskbitmask' => RISK_PERSONAL,
 333  
 334          'captype' => 'read',
 335          'contextlevel' => CONTEXT_MODULE,
 336          'archetypes' => array(
 337              'teacher' => CAP_ALLOW,
 338              'editingteacher' => CAP_ALLOW,
 339              'manager' => CAP_ALLOW,
 340          )
 341      ),
 342      'mod/forum:exportpost' => array(
 343  
 344          'riskbitmask' => RISK_PERSONAL,
 345  
 346          'captype' => 'read',
 347          'contextlevel' => CONTEXT_MODULE,
 348          'archetypes' => array(
 349              'teacher' => CAP_ALLOW,
 350              'editingteacher' => CAP_ALLOW,
 351              'manager' => CAP_ALLOW
 352          )
 353      ),
 354      'mod/forum:exportownpost' => array(
 355  
 356          'riskbitmask' => RISK_PERSONAL,
 357  
 358          'captype' => 'read',
 359          'contextlevel' => CONTEXT_MODULE,
 360          'archetypes' => array(
 361              'teacher' => CAP_ALLOW,
 362              'editingteacher' => CAP_ALLOW,
 363              'manager' => CAP_ALLOW,
 364              'student' => CAP_ALLOW,
 365          )
 366      ),
 367      'mod/forum:addquestion' => array(
 368  
 369          'riskbitmask' => RISK_SPAM,
 370  
 371          'captype' => 'write',
 372          'contextlevel' => CONTEXT_MODULE,
 373          'archetypes' => array(
 374              'teacher' => CAP_ALLOW,
 375              'editingteacher' => CAP_ALLOW,
 376              'manager' => CAP_ALLOW
 377          )
 378      ),
 379      'mod/forum:allowforcesubscribe' => array(
 380  
 381          'captype' => 'read',
 382          'contextlevel' => CONTEXT_MODULE,
 383          'archetypes' => array(
 384              'student' => CAP_ALLOW,
 385              'teacher' => CAP_ALLOW,
 386              'editingteacher' => CAP_ALLOW,
 387              'frontpage' => CAP_ALLOW
 388          )
 389      ),
 390      'mod/forum:canposttomygroups' => array(
 391  
 392          'captype' => 'write',
 393          'contextlevel' => CONTEXT_MODULE,
 394          'archetypes' => array(
 395              'teacher' => CAP_ALLOW,
 396              'editingteacher' => CAP_ALLOW,
 397              'manager' => CAP_ALLOW
 398          )
 399      ),
 400      'mod/forum:canoverridediscussionlock' => array(
 401          'captype' => 'write',
 402          'contextlevel' => CONTEXT_MODULE,
 403          'archetypes' => array(
 404              'teacher' => CAP_ALLOW,
 405              'editingteacher' => CAP_ALLOW,
 406              'manager' => CAP_ALLOW
 407          )
 408      ),
 409      'mod/forum:canoverridecutoff' => array(
 410          'captype' => 'write',
 411          'contextlevel' => CONTEXT_MODULE,
 412          'archetypes' => array(
 413              'teacher' => CAP_ALLOW,
 414              'editingteacher' => CAP_ALLOW,
 415              'manager' => CAP_ALLOW
 416          ),
 417          'clonepermissionsfrom' => 'mod/forum:canoverridediscussionlock'
 418      ),
 419      'mod/forum:cantogglefavourite' => array(
 420          'captype' => 'write',
 421          'contextlevel' => CONTEXT_MODULE,
 422          'archetypes' => array(
 423              'user' => CAP_ALLOW
 424          )
 425      ),
 426  
 427      'mod/forum:grade' => [
 428          'captype' => 'write',
 429          'contextlevel' => CONTEXT_MODULE,
 430          'archetypes' => [
 431              'teacher' => CAP_ALLOW,
 432              'editingteacher' => CAP_ALLOW,
 433              'manager' => CAP_ALLOW,
 434          ],
 435      ],
 436  );
 437