[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/db/ -> access.php (source)

   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 Moodle core.
  19   *
  20   * The capabilities are loaded into the database table when the module is
  21   * installed or updated. Whenever the capability definitions are updated,
  22   * the module version number should be bumped up.
  23   *
  24   * The system has four possible values for a capability:
  25   * CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
  26   *
  27   *
  28   * CAPABILITY NAMING CONVENTION
  29   *
  30   * It is important that capability names are unique. The naming convention
  31   * for capabilities that are specific to modules and blocks is as follows:
  32   *   [mod/block]/<plugin_name>:<capabilityname>
  33   *
  34   * component_name should be the same as the directory name of the mod or block.
  35   *
  36   * Core moodle capabilities are defined thus:
  37   *    moodle/<capabilityclass>:<capabilityname>
  38   *
  39   * Examples: mod/forum:viewpost
  40   *           block/recent_activity:view
  41   *           moodle/site:deleteuser
  42   *
  43   * The variable name for the capability definitions array is $capabilities
  44   *
  45   * For more information, take a look to the documentation available:
  46   *     - Access API: {@link http://docs.moodle.org/dev/Access_API}
  47   *     - Upgrade API: {@link http://docs.moodle.org/dev/Upgrade_API}
  48   *
  49   * @package   core_access
  50   * @category  access
  51   * @copyright 2006 onwards Martin Dougiamas  http://dougiamas.com
  52   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  53   */
  54  
  55  defined('MOODLE_INTERNAL') || die();
  56  
  57  $capabilities = array(
  58      'moodle/site:config' => array(
  59  
  60          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
  61  
  62          'captype' => 'write',
  63          'contextlevel' => CONTEXT_SYSTEM,
  64          'archetypes' => array(
  65          )
  66      ),
  67  
  68      'moodle/site:readallmessages' => array(
  69  
  70          'riskbitmask' => RISK_PERSONAL,
  71  
  72          'captype' => 'read',
  73          'contextlevel' => CONTEXT_SYSTEM,
  74          'archetypes' => array(
  75              'manager' => CAP_ALLOW,
  76              'editingteacher' => CAP_ALLOW
  77          )
  78      ),
  79  
  80      'moodle/site:sendmessage' => array(
  81  
  82          'riskbitmask' => RISK_SPAM,
  83  
  84          'captype' => 'write',
  85          'contextlevel' => CONTEXT_SYSTEM,
  86          'archetypes' => array(
  87              'manager' => CAP_ALLOW,
  88              'user' => CAP_ALLOW
  89          )
  90      ),
  91  
  92      'moodle/site:approvecourse' => array(
  93  
  94          'riskbitmask' => RISK_XSS,
  95  
  96          'captype' => 'write',
  97          'contextlevel' => CONTEXT_SYSTEM,
  98          'archetypes' => array(
  99              'manager' => CAP_ALLOW
 100          )
 101      ),
 102  
 103      'moodle/backup:backupcourse' => array(
 104  
 105          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 106  
 107          'captype' => 'write',
 108          'contextlevel' => CONTEXT_COURSE,
 109          'archetypes' => array(
 110              'editingteacher' => CAP_ALLOW,
 111              'manager' => CAP_ALLOW
 112          ),
 113  
 114          'clonepermissionsfrom' =>  'moodle/site:backup'
 115      ),
 116  
 117      'moodle/backup:backupsection' => array(
 118  
 119          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 120  
 121          'captype' => 'write',
 122          'contextlevel' => CONTEXT_COURSE,
 123          'archetypes' => array(
 124              'editingteacher' => CAP_ALLOW,
 125              'manager' => CAP_ALLOW
 126          ),
 127  
 128          'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
 129      ),
 130  
 131      'moodle/backup:backupactivity' => array(
 132  
 133          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 134  
 135          'captype' => 'write',
 136          'contextlevel' => CONTEXT_MODULE,
 137          'archetypes' => array(
 138              'editingteacher' => CAP_ALLOW,
 139              'manager' => CAP_ALLOW
 140          ),
 141  
 142          'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
 143      ),
 144  
 145      'moodle/backup:backuptargethub' => array(
 146  
 147          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 148  
 149          'captype' => 'write',
 150          'contextlevel' => CONTEXT_COURSE,
 151          'archetypes' => array(
 152              'editingteacher' => CAP_ALLOW,
 153              'manager' => CAP_ALLOW
 154          ),
 155  
 156          'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
 157      ),
 158  
 159      'moodle/backup:backuptargetimport' => array(
 160  
 161          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 162  
 163          'captype' => 'write',
 164          'contextlevel' => CONTEXT_COURSE,
 165          'archetypes' => array(
 166              'editingteacher' => CAP_ALLOW,
 167              'manager' => CAP_ALLOW
 168          ),
 169  
 170          'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
 171      ),
 172  
 173      'moodle/backup:downloadfile' => array(
 174  
 175          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 176  
 177          'captype' => 'write',
 178          'contextlevel' => CONTEXT_COURSE,
 179          'archetypes' => array(
 180              'editingteacher' => CAP_ALLOW,
 181              'manager' => CAP_ALLOW
 182          ),
 183  
 184          'clonepermissionsfrom' =>  'moodle/site:backupdownload'
 185      ),
 186  
 187      'moodle/backup:configure' => array(
 188  
 189          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 190  
 191          'captype' => 'write',
 192          'contextlevel' => CONTEXT_COURSE,
 193          'archetypes' => array(
 194              'editingteacher' => CAP_ALLOW,
 195              'manager' => CAP_ALLOW
 196          )
 197      ),
 198  
 199      'moodle/backup:userinfo' => array(
 200  
 201          'riskbitmask' => RISK_PERSONAL,
 202  
 203          'captype' => 'read',
 204          'contextlevel' => CONTEXT_COURSE,
 205          'archetypes' => array(
 206              'manager' => CAP_ALLOW
 207          )
 208      ),
 209  
 210      'moodle/backup:anonymise' => array(
 211  
 212          'riskbitmask' => RISK_PERSONAL,
 213  
 214          'captype' => 'read',
 215          'contextlevel' => CONTEXT_COURSE,
 216          'archetypes' => array(
 217              'manager' => CAP_ALLOW
 218          )
 219      ),
 220  
 221      'moodle/restore:restorecourse' => array(
 222  
 223          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 224  
 225          'captype' => 'write',
 226          'contextlevel' => CONTEXT_COURSE,
 227          'archetypes' => array(
 228              'editingteacher' => CAP_ALLOW,
 229              'manager' => CAP_ALLOW
 230          ),
 231  
 232          'clonepermissionsfrom' =>  'moodle/site:restore'
 233      ),
 234  
 235      'moodle/restore:restoresection' => array(
 236  
 237          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 238  
 239          'captype' => 'write',
 240          'contextlevel' => CONTEXT_COURSE,
 241          'archetypes' => array(
 242              'editingteacher' => CAP_ALLOW,
 243              'manager' => CAP_ALLOW
 244          ),
 245  
 246          'clonepermissionsfrom' =>  'moodle/restore:restorecourse'
 247      ),
 248  
 249      'moodle/restore:restoreactivity' => array(
 250  
 251          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 252  
 253          'captype' => 'write',
 254          'contextlevel' => CONTEXT_COURSE,
 255          'archetypes' => array(
 256              'editingteacher' => CAP_ALLOW,
 257              'manager' => CAP_ALLOW
 258          ),
 259  
 260          'clonepermissionsfrom' =>  'moodle/restore:restorecourse'
 261      ),
 262  
 263      'moodle/restore:viewautomatedfilearea' => array(
 264  
 265          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 266  
 267          'captype' => 'write',
 268          'contextlevel' => CONTEXT_COURSE,
 269      ),
 270  
 271      'moodle/restore:restoretargethub' => array(
 272  
 273          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 274  
 275          'captype' => 'write',
 276          'contextlevel' => CONTEXT_COURSE,
 277          'archetypes' => array(
 278              'editingteacher' => CAP_ALLOW,
 279              'manager' => CAP_ALLOW
 280          ),
 281  
 282          'clonepermissionsfrom' =>  'moodle/restore:restorecourse'
 283      ),
 284  
 285      'moodle/restore:restoretargetimport' => array(
 286  
 287          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 288  
 289          'captype' => 'write',
 290          'contextlevel' => CONTEXT_COURSE,
 291          'archetypes' => array(
 292              'editingteacher' => CAP_ALLOW,
 293              'manager' => CAP_ALLOW
 294          ),
 295  
 296          'clonepermissionsfrom' =>  'moodle/site:import'
 297      ),
 298  
 299      'moodle/restore:uploadfile' => array(
 300  
 301          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 302  
 303          'captype' => 'write',
 304          'contextlevel' => CONTEXT_COURSE,
 305          'archetypes' => array(
 306              'editingteacher' => CAP_ALLOW,
 307              'manager' => CAP_ALLOW
 308          ),
 309  
 310          'clonepermissionsfrom' =>  'moodle/site:backupupload'
 311      ),
 312  
 313      'moodle/restore:configure' => array(
 314  
 315          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 316  
 317          'captype' => 'write',
 318          'contextlevel' => CONTEXT_COURSE,
 319          'archetypes' => array(
 320              'editingteacher' => CAP_ALLOW,
 321              'manager' => CAP_ALLOW
 322          )
 323      ),
 324  
 325      'moodle/restore:rolldates' => array(
 326  
 327          'captype' => 'write',
 328          'contextlevel' => CONTEXT_COURSE,
 329          'archetypes' => array(
 330              'coursecreator' => CAP_ALLOW,
 331              'manager' => CAP_ALLOW
 332          )
 333      ),
 334  
 335      'moodle/restore:userinfo' => array(
 336  
 337          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
 338  
 339          'captype' => 'write',
 340          'contextlevel' => CONTEXT_COURSE,
 341          'archetypes' => array(
 342              'manager' => CAP_ALLOW
 343          )
 344      ),
 345  
 346      'moodle/restore:createuser' => array(
 347  
 348          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
 349  
 350          'captype' => 'write',
 351          'contextlevel' => CONTEXT_SYSTEM,
 352          'archetypes' => array(
 353              'manager' => CAP_ALLOW
 354          )
 355      ),
 356  
 357      'moodle/site:manageblocks' => array(
 358  
 359          'riskbitmask' => RISK_SPAM | RISK_XSS,
 360  
 361          'captype' => 'write',
 362          'contextlevel' => CONTEXT_BLOCK,
 363          'archetypes' => array(
 364              'editingteacher' => CAP_ALLOW,
 365              'manager' => CAP_ALLOW
 366          )
 367      ),
 368  
 369      'moodle/site:accessallgroups' => array(
 370  
 371          'captype' => 'read',
 372          'contextlevel' => CONTEXT_COURSE,
 373          'archetypes' => array(
 374              'teacher' => CAP_ALLOW,
 375              'editingteacher' => CAP_ALLOW,
 376              'manager' => CAP_ALLOW
 377          )
 378      ),
 379  
 380      'moodle/site:viewfullnames' => array(
 381  
 382          'captype' => 'read',
 383          'contextlevel' => CONTEXT_COURSE,
 384          'archetypes' => array(
 385              'teacher' => CAP_ALLOW,
 386              'editingteacher' => CAP_ALLOW,
 387              'manager' => CAP_ALLOW
 388          )
 389      ),
 390  
 391      // In reports that give lists of users, extra information about each user's
 392      // identity (the fields configured in site option showuseridentity) will be
 393      // displayed to users who have this capability.
 394      'moodle/site:viewuseridentity' => array(
 395  
 396          'captype' => 'read',
 397          'contextlevel' => CONTEXT_COURSE,
 398          'archetypes' => array(
 399              'teacher' => CAP_ALLOW,
 400              'editingteacher' => CAP_ALLOW,
 401              'manager' => CAP_ALLOW
 402          )
 403      ),
 404  
 405      'moodle/site:viewreports' => array(
 406  
 407          'riskbitmask' => RISK_PERSONAL,
 408  
 409          'captype' => 'read',
 410          'contextlevel' => CONTEXT_COURSE,
 411          'archetypes' => array(
 412              'teacher' => CAP_ALLOW,
 413              'editingteacher' => CAP_ALLOW,
 414              'manager' => CAP_ALLOW
 415          )
 416      ),
 417  
 418      'moodle/site:trustcontent' => array(
 419  
 420          'riskbitmask' => RISK_XSS,
 421  
 422          'captype' => 'write',
 423          'contextlevel' => CONTEXT_COURSE,
 424          'archetypes' => array(
 425              'editingteacher' => CAP_ALLOW,
 426              'manager' => CAP_ALLOW
 427          )
 428      ),
 429  
 430      'moodle/site:uploadusers' => array(
 431  
 432          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
 433  
 434          'captype' => 'write',
 435          'contextlevel' => CONTEXT_SYSTEM,
 436          'archetypes' => array(
 437              'manager' => CAP_ALLOW
 438          )
 439      ),
 440  
 441      // Permission to manage filter setting overrides in subcontexts.
 442      'moodle/filter:manage' => array(
 443  
 444          'captype' => 'write',
 445          'contextlevel' => CONTEXT_COURSE,
 446          'archetypes' => array(
 447              'editingteacher' => CAP_ALLOW,
 448              'manager' => CAP_ALLOW,
 449          )
 450      ),
 451  
 452      'moodle/user:create' => array(
 453  
 454          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
 455  
 456          'captype' => 'write',
 457          'contextlevel' => CONTEXT_SYSTEM,
 458          'archetypes' => array(
 459              'manager' => CAP_ALLOW
 460          )
 461      ),
 462  
 463      'moodle/user:delete' => array(
 464  
 465          'riskbitmask' => RISK_PERSONAL, RISK_DATALOSS,
 466  
 467          'captype' => 'write',
 468          'contextlevel' => CONTEXT_SYSTEM,
 469          'archetypes' => array(
 470              'manager' => CAP_ALLOW
 471          )
 472      ),
 473  
 474      'moodle/user:update' => array(
 475  
 476          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
 477  
 478          'captype' => 'write',
 479          'contextlevel' => CONTEXT_SYSTEM,
 480          'archetypes' => array(
 481              'manager' => CAP_ALLOW
 482          )
 483      ),
 484  
 485      'moodle/user:viewdetails' => array(
 486  
 487          'captype' => 'read',
 488          'contextlevel' => CONTEXT_COURSE,
 489          'archetypes' => array(
 490              'guest' => CAP_ALLOW,
 491              'student' => CAP_ALLOW,
 492              'teacher' => CAP_ALLOW,
 493              'editingteacher' => CAP_ALLOW,
 494              'manager' => CAP_ALLOW
 495          )
 496      ),
 497  
 498      'moodle/user:viewalldetails' => array(
 499          'riskbitmask' => RISK_PERSONAL,
 500          'captype' => 'read',
 501          'contextlevel' => CONTEXT_USER,
 502          'archetypes' => array(
 503              'manager' => CAP_ALLOW
 504          ),
 505          'clonepermissionsfrom' => 'moodle/user:update'
 506      ),
 507  
 508      'moodle/user:viewlastip' => array(
 509          'riskbitmask' => RISK_PERSONAL,
 510          'captype' => 'read',
 511          'contextlevel' => CONTEXT_USER,
 512          'archetypes' => array(
 513              'manager' => CAP_ALLOW
 514          ),
 515          'clonepermissionsfrom' => 'moodle/user:update'
 516      ),
 517  
 518      'moodle/user:viewhiddendetails' => array(
 519  
 520          'riskbitmask' => RISK_PERSONAL,
 521  
 522          'captype' => 'read',
 523          'contextlevel' => CONTEXT_COURSE,
 524          'archetypes' => array(
 525              'teacher' => CAP_ALLOW,
 526              'editingteacher' => CAP_ALLOW,
 527              'manager' => CAP_ALLOW
 528          )
 529      ),
 530  
 531      'moodle/user:loginas' => array(
 532  
 533          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
 534  
 535          'captype' => 'write',
 536          'contextlevel' => CONTEXT_COURSE,
 537          'archetypes' => array(
 538              'manager' => CAP_ALLOW
 539          )
 540      ),
 541  
 542      // can the user manage the system default profile page?
 543      'moodle/user:managesyspages' => array(
 544  
 545          'riskbitmap' => RISK_SPAM | RISK_PERSONAL | RISK_CONFIG,
 546  
 547          'captype' => 'write',
 548          'contextlevel' => CONTEXT_SYSTEM,
 549          'archetypes' => array(
 550              'manager' => CAP_ALLOW
 551          )
 552      ),
 553  
 554      // can the user manage another user's profile page?
 555      'moodle/user:manageblocks' => array(
 556  
 557          'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
 558  
 559          'captype' => 'write',
 560          'contextlevel' => CONTEXT_USER
 561      ),
 562  
 563      // can the user manage their own profile page?
 564      'moodle/user:manageownblocks' => array(
 565  
 566          'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
 567  
 568          'captype' => 'write',
 569          'contextlevel' => CONTEXT_SYSTEM,
 570          'archetypes' => array(
 571              'user' => CAP_ALLOW
 572          )
 573      ),
 574  
 575      // can the user manage their own files?
 576      'moodle/user:manageownfiles' => array(
 577  
 578          'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
 579  
 580          'captype' => 'write',
 581          'contextlevel' => CONTEXT_SYSTEM,
 582          'archetypes' => array(
 583              'user' => CAP_ALLOW
 584          )
 585      ),
 586  
 587      // Can the user ignore the setting userquota?
 588      // The permissions are cloned from ignorefilesizelimits as it was partly used for that purpose.
 589      'moodle/user:ignoreuserquota' => array(
 590          'riskbitmap' => RISK_SPAM,
 591          'captype' => 'write',
 592          'contextlevel' => CONTEXT_SYSTEM,
 593          'clonepermissionsfrom' => 'moodle/course:ignorefilesizelimits'
 594      ),
 595  
 596      // can the user manage the system default dashboard page?
 597      'moodle/my:configsyspages' => array(
 598  
 599          'riskbitmap' => RISK_SPAM | RISK_PERSONAL | RISK_CONFIG,
 600  
 601          'captype' => 'write',
 602          'contextlevel' => CONTEXT_SYSTEM,
 603          'archetypes' => array(
 604              'manager' => CAP_ALLOW
 605          )
 606      ),
 607  
 608      'moodle/role:assign' => array(
 609  
 610          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 611  
 612          'captype' => 'write',
 613          'contextlevel' => CONTEXT_COURSE,
 614          'archetypes' => array(
 615              'editingteacher' => CAP_ALLOW,
 616              'manager' => CAP_ALLOW
 617          )
 618      ),
 619  
 620      'moodle/role:review' => array(
 621  
 622          'riskbitmask' => RISK_PERSONAL,
 623  
 624          'captype' => 'read',
 625          'contextlevel' => CONTEXT_COURSE,
 626          'archetypes' => array(
 627              'teacher' => CAP_ALLOW,
 628              'editingteacher' => CAP_ALLOW,
 629              'manager' => CAP_ALLOW
 630          )
 631      ),
 632  
 633      'moodle/role:override' => array(
 634  
 635          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 636  
 637          'captype' => 'write',
 638          'contextlevel' => CONTEXT_COURSE,
 639          'archetypes' => array(
 640              'manager' => CAP_ALLOW
 641          )
 642      ),
 643  
 644      'moodle/role:safeoverride' => array(
 645  
 646          'riskbitmask' => RISK_SPAM,
 647  
 648          'captype' => 'write',
 649          'contextlevel' => CONTEXT_COURSE,
 650          'archetypes' => array(
 651              'editingteacher' => CAP_ALLOW
 652          )
 653      ),
 654  
 655      'moodle/role:manage' => array(
 656  
 657          'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
 658  
 659          'captype' => 'write',
 660          'contextlevel' => CONTEXT_SYSTEM,
 661          'archetypes' => array(
 662              'manager' => CAP_ALLOW
 663          )
 664      ),
 665  
 666      'moodle/role:switchroles' => array(
 667  
 668          'riskbitmask' => RISK_XSS | RISK_PERSONAL,
 669  
 670          'captype' => 'read',
 671          'contextlevel' => CONTEXT_COURSE,
 672          'archetypes' => array(
 673              'editingteacher' => CAP_ALLOW,
 674              'manager' => CAP_ALLOW
 675          )
 676      ),
 677  
 678      // Create, update and delete course categories. (Deleting a course category
 679      // does not let you delete the courses it contains, unless you also have
 680      // moodle/course: delete.) Creating and deleting requires this permission in
 681      // the parent category.
 682      'moodle/category:manage' => array(
 683  
 684          'riskbitmask' => RISK_XSS,
 685  
 686          'captype' => 'write',
 687          'contextlevel' => CONTEXT_COURSECAT,
 688          'archetypes' => array(
 689              'manager' => CAP_ALLOW
 690          ),
 691          'clonepermissionsfrom' => 'moodle/category:update'
 692      ),
 693  
 694      'moodle/category:viewhiddencategories' => array(
 695  
 696          'captype' => 'read',
 697          'contextlevel' => CONTEXT_COURSECAT,
 698          'archetypes' => array(
 699              'coursecreator' => CAP_ALLOW,
 700              'manager' => CAP_ALLOW
 701          ),
 702          'clonepermissionsfrom' => 'moodle/category:visibility'
 703      ),
 704  
 705      // create, delete, move cohorts in system and course categories,
 706      // (cohorts with component !== null can be only moved)
 707      'moodle/cohort:manage' => array(
 708  
 709          'captype' => 'write',
 710          'contextlevel' => CONTEXT_COURSECAT,
 711          'archetypes' => array(
 712              'manager' => CAP_ALLOW
 713          )
 714      ),
 715  
 716      // add and remove cohort members (only for cohorts where component !== null)
 717      'moodle/cohort:assign' => array(
 718  
 719          'captype' => 'write',
 720          'contextlevel' => CONTEXT_COURSECAT,
 721          'archetypes' => array(
 722              'manager' => CAP_ALLOW
 723          )
 724      ),
 725  
 726      // View visible and hidden cohorts defined in the current context.
 727      'moodle/cohort:view' => array(
 728  
 729          'captype' => 'read',
 730          'contextlevel' => CONTEXT_COURSE,
 731          'archetypes' => array(
 732              'editingteacher' => CAP_ALLOW,
 733              'manager' => CAP_ALLOW
 734          )
 735      ),
 736  
 737      'moodle/course:create' => array(
 738  
 739          'riskbitmask' => RISK_XSS,
 740  
 741          'captype' => 'write',
 742          'contextlevel' => CONTEXT_COURSECAT,
 743          'archetypes' => array(
 744              'coursecreator' => CAP_ALLOW,
 745              'manager' => CAP_ALLOW
 746          )
 747      ),
 748  
 749      'moodle/course:request' => array(
 750          'captype' => 'write',
 751          'contextlevel' => CONTEXT_SYSTEM,
 752          'archetypes' => array(
 753              'user' => CAP_ALLOW,
 754          )
 755      ),
 756  
 757      'moodle/course:delete' => array(
 758  
 759          'riskbitmask' => RISK_DATALOSS,
 760  
 761          'captype' => 'write',
 762          'contextlevel' => CONTEXT_COURSE,
 763          'archetypes' => array(
 764              'manager' => CAP_ALLOW
 765          )
 766      ),
 767  
 768      'moodle/course:update' => array(
 769  
 770          'riskbitmask' => RISK_XSS,
 771  
 772          'captype' => 'write',
 773          'contextlevel' => CONTEXT_COURSE,
 774          'archetypes' => array(
 775              'editingteacher' => CAP_ALLOW,
 776              'manager' => CAP_ALLOW
 777          )
 778      ),
 779  
 780      'moodle/course:view' => array(
 781  
 782          'captype' => 'read',
 783          'contextlevel' => CONTEXT_COURSE,
 784          'archetypes' => array(
 785              'manager' => CAP_ALLOW,
 786          )
 787      ),
 788  
 789      /* review course enrolments - no group restrictions, it is really full access to all participants info*/
 790      'moodle/course:enrolreview' => array(
 791  
 792          'riskbitmask' => RISK_PERSONAL,
 793  
 794          'captype' => 'read',
 795          'contextlevel' => CONTEXT_COURSE,
 796          'archetypes' => array(
 797              'editingteacher' => CAP_ALLOW,
 798              'manager' => CAP_ALLOW,
 799          )
 800      ),
 801  
 802      /* add, remove, hide enrol instances in courses */
 803      'moodle/course:enrolconfig' => array(
 804  
 805          'riskbitmask' => RISK_PERSONAL,
 806  
 807          'captype' => 'write',
 808          'contextlevel' => CONTEXT_COURSE,
 809          'archetypes' => array(
 810              'editingteacher' => CAP_ALLOW,
 811              'manager' => CAP_ALLOW,
 812          )
 813      ),
 814  
 815      'moodle/course:reviewotherusers' => array(
 816  
 817          'captype' => 'read',
 818          'contextlevel' => CONTEXT_COURSE,
 819          'archetypes' => array(
 820              'editingteacher' => CAP_ALLOW,
 821              'manager' => CAP_ALLOW,
 822          ),
 823          'clonepermissionsfrom' => 'moodle/role:assign'
 824      ),
 825  
 826      'moodle/course:bulkmessaging' => array(
 827  
 828          'riskbitmask' => RISK_SPAM,
 829  
 830          'captype' => 'write',
 831          'contextlevel' => CONTEXT_COURSE,
 832          'archetypes' => array(
 833              'teacher' => CAP_ALLOW,
 834              'editingteacher' => CAP_ALLOW,
 835              'manager' => CAP_ALLOW
 836          )
 837      ),
 838  
 839      'moodle/course:viewhiddenuserfields' => array(
 840  
 841          'riskbitmask' => RISK_PERSONAL,
 842  
 843          'captype' => 'read',
 844          'contextlevel' => CONTEXT_COURSE,
 845          'archetypes' => array(
 846              'teacher' => CAP_ALLOW,
 847              'editingteacher' => CAP_ALLOW,
 848              'manager' => CAP_ALLOW
 849          )
 850      ),
 851  
 852      'moodle/course:viewhiddencourses' => array(
 853  
 854          'captype' => 'read',
 855          'contextlevel' => CONTEXT_COURSE,
 856          'archetypes' => array(
 857              'coursecreator' => CAP_ALLOW,
 858              'teacher' => CAP_ALLOW,
 859              'editingteacher' => CAP_ALLOW,
 860              'manager' => CAP_ALLOW
 861          )
 862      ),
 863  
 864      'moodle/course:visibility' => array(
 865  
 866          'captype' => 'write',
 867          'contextlevel' => CONTEXT_COURSE,
 868          'archetypes' => array(
 869              'editingteacher' => CAP_ALLOW,
 870              'manager' => CAP_ALLOW
 871          )
 872      ),
 873  
 874      'moodle/course:managefiles' => array(
 875  
 876          'riskbitmask' => RISK_XSS,
 877  
 878          'captype' => 'write',
 879          'contextlevel' => CONTEXT_COURSE,
 880          'archetypes' => array(
 881              'editingteacher' => CAP_ALLOW,
 882              'manager' => CAP_ALLOW
 883          )
 884      ),
 885  
 886      'moodle/course:ignorefilesizelimits' => array(
 887  
 888          'captype' => 'write',
 889          'contextlevel' => CONTEXT_COURSE,
 890          'archetypes' => array(
 891          )
 892      ),
 893  
 894      'moodle/course:manageactivities' => array(
 895  
 896          'riskbitmask' => RISK_XSS,
 897  
 898          'captype' => 'write',
 899          'contextlevel' => CONTEXT_MODULE,
 900          'archetypes' => array(
 901              'editingteacher' => CAP_ALLOW,
 902              'manager' => CAP_ALLOW
 903          )
 904      ),
 905  
 906      'moodle/course:activityvisibility' => array(
 907  
 908          'captype' => 'write',
 909          'contextlevel' => CONTEXT_MODULE,
 910          'archetypes' => array(
 911              'editingteacher' => CAP_ALLOW,
 912              'manager' => CAP_ALLOW
 913          )
 914      ),
 915  
 916      'moodle/course:viewhiddenactivities' => array(
 917  
 918          'captype' => 'write',
 919          'contextlevel' => CONTEXT_MODULE,
 920          'archetypes' => array(
 921              'teacher' => CAP_ALLOW,
 922              'editingteacher' => CAP_ALLOW,
 923              'manager' => CAP_ALLOW
 924          )
 925      ),
 926  
 927      'moodle/course:viewparticipants' => array(
 928  
 929          'captype' => 'read',
 930          'contextlevel' => CONTEXT_COURSE,
 931          'archetypes' => array(
 932              'student' => CAP_ALLOW,
 933              'teacher' => CAP_ALLOW,
 934              'editingteacher' => CAP_ALLOW,
 935              'manager' => CAP_ALLOW
 936          )
 937      ),
 938  
 939      'moodle/course:changefullname' => array(
 940  
 941          'riskbitmask' => RISK_XSS,
 942  
 943          'captype' => 'write',
 944          'contextlevel' => CONTEXT_COURSE,
 945          'archetypes' => array(
 946              'editingteacher' => CAP_ALLOW,
 947              'manager' => CAP_ALLOW
 948          ),
 949          'clonepermissionsfrom' => 'moodle/course:update'
 950      ),
 951  
 952      'moodle/course:changeshortname' => array(
 953  
 954          'riskbitmask' => RISK_XSS,
 955  
 956          'captype' => 'write',
 957          'contextlevel' => CONTEXT_COURSE,
 958          'archetypes' => array(
 959              'editingteacher' => CAP_ALLOW,
 960              'manager' => CAP_ALLOW
 961          ),
 962          'clonepermissionsfrom' => 'moodle/course:update'
 963      ),
 964  
 965      'moodle/course:changeidnumber' => array(
 966  
 967          'riskbitmask' => RISK_XSS,
 968  
 969          'captype' => 'write',
 970          'contextlevel' => CONTEXT_COURSE,
 971          'archetypes' => array(
 972              'editingteacher' => CAP_ALLOW,
 973              'manager' => CAP_ALLOW
 974          ),
 975          'clonepermissionsfrom' => 'moodle/course:update'
 976      ),
 977      'moodle/course:changecategory' => array(
 978          'riskbitmask' => RISK_XSS,
 979  
 980          'captype' => 'write',
 981          'contextlevel' => CONTEXT_COURSE,
 982          'archetypes' => array(
 983              'editingteacher' => CAP_ALLOW,
 984              'manager' => CAP_ALLOW
 985          ),
 986          'clonepermissionsfrom' => 'moodle/course:update'
 987      ),
 988  
 989      'moodle/course:changesummary' => array(
 990          'riskbitmask' => RISK_XSS,
 991  
 992          'captype' => 'write',
 993          'contextlevel' => CONTEXT_COURSE,
 994          'archetypes' => array(
 995              'editingteacher' => CAP_ALLOW,
 996              'manager' => CAP_ALLOW
 997          ),
 998          'clonepermissionsfrom' => 'moodle/course:update'
 999      ),
1000  
1001  
1002      'moodle/site:viewparticipants' => array(
1003  
1004          'captype' => 'read',
1005          'contextlevel' => CONTEXT_SYSTEM,
1006          'archetypes' => array(
1007              'manager' => CAP_ALLOW
1008          )
1009      ),
1010  
1011      'moodle/course:isincompletionreports' => array(
1012          'captype' => 'read',
1013          'contextlevel' => CONTEXT_COURSE,
1014          'archetypes' => array(
1015              'student' => CAP_ALLOW,
1016          ),
1017      ),
1018  
1019      'moodle/course:viewscales' => array(
1020  
1021          'captype' => 'read',
1022          'contextlevel' => CONTEXT_COURSE,
1023          'archetypes' => array(
1024              'student' => CAP_ALLOW,
1025              'teacher' => CAP_ALLOW,
1026              'editingteacher' => CAP_ALLOW,
1027              'manager' => CAP_ALLOW
1028          )
1029      ),
1030  
1031      'moodle/course:managescales' => array(
1032  
1033          'captype' => 'write',
1034          'contextlevel' => CONTEXT_COURSE,
1035          'archetypes' => array(
1036              'editingteacher' => CAP_ALLOW,
1037              'manager' => CAP_ALLOW
1038          )
1039      ),
1040  
1041      'moodle/course:managegroups' => array(
1042  
1043          'captype' => 'write',
1044          'contextlevel' => CONTEXT_COURSE,
1045          'archetypes' => array(
1046              'editingteacher' => CAP_ALLOW,
1047              'manager' => CAP_ALLOW
1048          )
1049      ),
1050  
1051      'moodle/course:reset' => array(
1052  
1053          'riskbitmask' => RISK_DATALOSS,
1054  
1055          'captype' => 'write',
1056          'contextlevel' => CONTEXT_COURSE,
1057          'archetypes' => array(
1058              'editingteacher' => CAP_ALLOW,
1059              'manager' => CAP_ALLOW
1060          )
1061      ),
1062  
1063      'moodle/course:viewsuspendedusers' => array(
1064  
1065          'captype' => 'read',
1066          'contextlevel' => CONTEXT_SYSTEM,
1067          'archetypes' => array(
1068              'editingteacher' => CAP_ALLOW,
1069              'manager' => CAP_ALLOW
1070          )
1071      ),
1072  
1073      'moodle/blog:view' => array(
1074  
1075          'captype' => 'read',
1076          'contextlevel' => CONTEXT_SYSTEM,
1077          'archetypes' => array(
1078              'guest' => CAP_ALLOW,
1079              'user' => CAP_ALLOW,
1080              'student' => CAP_ALLOW,
1081              'teacher' => CAP_ALLOW,
1082              'editingteacher' => CAP_ALLOW,
1083              'manager' => CAP_ALLOW
1084          )
1085      ),
1086  
1087      'moodle/blog:search' => array(
1088          'captype' => 'read',
1089          'contextlevel' => CONTEXT_SYSTEM,
1090          'archetypes' => array(
1091              'guest' => CAP_ALLOW,
1092              'user' => CAP_ALLOW,
1093              'student' => CAP_ALLOW,
1094              'teacher' => CAP_ALLOW,
1095              'editingteacher' => CAP_ALLOW,
1096              'manager' => CAP_ALLOW
1097          )
1098      ),
1099  
1100      'moodle/blog:viewdrafts' => array(
1101  
1102          'riskbitmask' => RISK_PERSONAL,
1103          'captype' => 'read',
1104          'contextlevel' => CONTEXT_SYSTEM,
1105          'archetypes' => array(
1106              'manager' => CAP_ALLOW
1107          )
1108      ),
1109  
1110      'moodle/blog:create' => array( // works in CONTEXT_SYSTEM only
1111  
1112          'riskbitmask' => RISK_SPAM,
1113  
1114          'captype' => 'write',
1115          'contextlevel' => CONTEXT_SYSTEM,
1116          'archetypes' => array(
1117              'user' => CAP_ALLOW,
1118              'manager' => CAP_ALLOW
1119          )
1120      ),
1121  
1122      'moodle/blog:manageentries' => array(
1123  
1124          'riskbitmask' => RISK_SPAM,
1125  
1126          'captype' => 'write',
1127          'contextlevel' => CONTEXT_SYSTEM,
1128          'archetypes' => array(
1129              'teacher' => CAP_ALLOW,
1130              'editingteacher' => CAP_ALLOW,
1131              'manager' => CAP_ALLOW
1132          )
1133      ),
1134  
1135      'moodle/blog:manageexternal' => array(
1136  
1137          'riskbitmask' => RISK_SPAM,
1138  
1139          'captype' => 'write',
1140          'contextlevel' => CONTEXT_SYSTEM,
1141          'archetypes' => array(
1142              'student' => CAP_ALLOW,
1143              'user' => CAP_ALLOW,
1144              'teacher' => CAP_ALLOW,
1145              'editingteacher' => CAP_ALLOW,
1146              'manager' => CAP_ALLOW
1147          )
1148      ),
1149  
1150      // TODO: Remove 'moodle/blog:associatecourse' and 'moodle/blog:associatemodule' after a few releases.
1151      'moodle/blog:associatecourse' => array(
1152  
1153          'captype' => 'write',
1154          'contextlevel' => CONTEXT_COURSE,
1155          'archetypes' => array()
1156      ),
1157  
1158      'moodle/blog:associatemodule' => array(
1159  
1160          'captype' => 'write',
1161          'contextlevel' => CONTEXT_MODULE,
1162          'archetypes' => array()
1163      ),
1164  
1165      'moodle/calendar:manageownentries' => array( // works in CONTEXT_SYSTEM only
1166  
1167          'riskbitmask' => RISK_SPAM,
1168  
1169          'captype' => 'write',
1170          'contextlevel' => CONTEXT_COURSE,
1171          'archetypes' => array(
1172              'user' => CAP_ALLOW,
1173              'manager' => CAP_ALLOW
1174          )
1175      ),
1176  
1177      'moodle/calendar:managegroupentries' => array(
1178  
1179          'riskbitmask' => RISK_SPAM,
1180  
1181          'captype' => 'write',
1182          'contextlevel' => CONTEXT_COURSE,
1183          'archetypes' => array(
1184              'teacher' => CAP_ALLOW,
1185              'editingteacher' => CAP_ALLOW,
1186              'manager' => CAP_ALLOW
1187          )
1188      ),
1189  
1190      'moodle/calendar:manageentries' => array(
1191  
1192          'riskbitmask' => RISK_SPAM,
1193  
1194          'captype' => 'write',
1195          'contextlevel' => CONTEXT_COURSE,
1196          'archetypes' => array(
1197              'teacher' => CAP_ALLOW,
1198              'editingteacher' => CAP_ALLOW,
1199              'manager' => CAP_ALLOW
1200          )
1201      ),
1202  
1203      'moodle/user:editprofile' => array(
1204  
1205          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1206  
1207          'captype' => 'write',
1208          'contextlevel' => CONTEXT_USER,
1209          'archetypes' => array(
1210              'manager' => CAP_ALLOW
1211          )
1212      ),
1213  
1214      'moodle/user:editownprofile' => array(
1215  
1216          'riskbitmask' => RISK_SPAM,
1217  
1218          'captype' => 'write',
1219          'contextlevel' => CONTEXT_SYSTEM,
1220          'archetypes' => array(
1221              'guest' => CAP_PROHIBIT,
1222              'user' => CAP_ALLOW,
1223              'manager' => CAP_ALLOW
1224          )
1225      ),
1226  
1227      'moodle/user:changeownpassword' => array(
1228  
1229          'captype' => 'write',
1230          'contextlevel' => CONTEXT_SYSTEM,
1231          'archetypes' => array(
1232              'guest' => CAP_PROHIBIT,
1233              'user' => CAP_ALLOW,
1234              'manager' => CAP_ALLOW
1235          )
1236      ),
1237  
1238      // The next 3 might make no sense for some roles, e.g teacher, etc.
1239      // since the next level up is site. These are more for the parent role
1240      'moodle/user:readuserposts' => array(
1241  
1242          'captype' => 'read',
1243          'contextlevel' => CONTEXT_USER,
1244          'archetypes' => array(
1245              'student' => CAP_ALLOW,
1246              'teacher' => CAP_ALLOW,
1247              'editingteacher' => CAP_ALLOW,
1248              'manager' => CAP_ALLOW
1249          )
1250      ),
1251  
1252      'moodle/user:readuserblogs' => array(
1253  
1254          'captype' => 'read',
1255          'contextlevel' => CONTEXT_USER,
1256          'archetypes' => array(
1257              'student' => CAP_ALLOW,
1258              'teacher' => CAP_ALLOW,
1259              'editingteacher' => CAP_ALLOW,
1260              'manager' => CAP_ALLOW
1261          )
1262      ),
1263  
1264      // designed for parent role - not used in legacy roles
1265      'moodle/user:viewuseractivitiesreport' => array(
1266          'riskbitmask' => RISK_PERSONAL,
1267  
1268          'captype' => 'read',
1269          'contextlevel' => CONTEXT_USER,
1270          'archetypes' => array(
1271          )
1272      ),
1273  
1274      //capabilities designed for the new message system configuration
1275      'moodle/user:editmessageprofile' => array(
1276  
1277           'riskbitmask' => RISK_SPAM,
1278  
1279           'captype' => 'write',
1280           'contextlevel' => CONTEXT_USER,
1281           'archetypes' => array(
1282               'manager' => CAP_ALLOW
1283           )
1284       ),
1285  
1286       'moodle/user:editownmessageprofile' => array(
1287  
1288           'captype' => 'write',
1289           'contextlevel' => CONTEXT_SYSTEM,
1290           'archetypes' => array(
1291               'guest' => CAP_PROHIBIT,
1292               'user' => CAP_ALLOW,
1293               'manager' => CAP_ALLOW
1294           )
1295       ),
1296  
1297      'moodle/question:managecategory' => array(
1298          'riskbitmask' => RISK_SPAM | RISK_XSS,
1299          'captype' => 'write',
1300          'contextlevel' => CONTEXT_COURSE,
1301          'archetypes' => array(
1302              'editingteacher' => CAP_ALLOW,
1303              'manager' => CAP_ALLOW
1304          )
1305      ),
1306  
1307      //new in moodle 1.9
1308      'moodle/question:add' => array(
1309          'riskbitmask' => RISK_SPAM | RISK_XSS,
1310          'captype' => 'write',
1311          'contextlevel' => CONTEXT_COURSE,
1312          'archetypes' => array(
1313              'editingteacher' => CAP_ALLOW,
1314              'manager' => CAP_ALLOW
1315          ),
1316          'clonepermissionsfrom' =>  'moodle/question:manage'
1317      ),
1318      'moodle/question:editmine' => array(
1319          'riskbitmask' => RISK_SPAM | RISK_XSS,
1320          'captype' => 'write',
1321          'contextlevel' => CONTEXT_COURSE,
1322          'archetypes' => array(
1323              'editingteacher' => CAP_ALLOW,
1324              'manager' => CAP_ALLOW
1325          ),
1326          'clonepermissionsfrom' =>  'moodle/question:manage'
1327      ),
1328      'moodle/question:editall' => array(
1329          'riskbitmask' => RISK_SPAM | RISK_XSS,
1330          'captype' => 'write',
1331          'contextlevel' => CONTEXT_COURSE,
1332          'archetypes' => array(
1333              'editingteacher' => CAP_ALLOW,
1334              'manager' => CAP_ALLOW
1335          ),
1336          'clonepermissionsfrom' =>  'moodle/question:manage'
1337      ),
1338      'moodle/question:viewmine' => array(
1339          'captype' => 'read',
1340          'contextlevel' => CONTEXT_COURSE,
1341          'archetypes' => array(
1342              'editingteacher' => CAP_ALLOW,
1343              'manager' => CAP_ALLOW
1344          ),
1345          'clonepermissionsfrom' =>  'moodle/question:manage'
1346      ),
1347      'moodle/question:viewall' => array(
1348          'captype' => 'read',
1349          'contextlevel' => CONTEXT_COURSE,
1350          'archetypes' => array(
1351              'editingteacher' => CAP_ALLOW,
1352              'manager' => CAP_ALLOW
1353          ),
1354          'clonepermissionsfrom' =>  'moodle/question:manage'
1355      ),
1356      'moodle/question:usemine' => array(
1357          'captype' => 'read',
1358          'contextlevel' => CONTEXT_COURSE,
1359          'archetypes' => array(
1360              'editingteacher' => CAP_ALLOW,
1361              'manager' => CAP_ALLOW
1362          ),
1363          'clonepermissionsfrom' =>  'moodle/question:manage'
1364      ),
1365      'moodle/question:useall' => array(
1366          'captype' => 'read',
1367          'contextlevel' => CONTEXT_COURSE,
1368          'archetypes' => array(
1369              'editingteacher' => CAP_ALLOW,
1370              'manager' => CAP_ALLOW
1371          ),
1372          'clonepermissionsfrom' =>  'moodle/question:manage'
1373      ),
1374      'moodle/question:movemine' => array(
1375          'captype' => 'write',
1376          'contextlevel' => CONTEXT_COURSE,
1377          'archetypes' => array(
1378              'editingteacher' => CAP_ALLOW,
1379              'manager' => CAP_ALLOW
1380          ),
1381          'clonepermissionsfrom' =>  'moodle/question:manage'
1382      ),
1383      'moodle/question:moveall' => array(
1384          'captype' => 'write',
1385          'contextlevel' => CONTEXT_COURSE,
1386          'archetypes' => array(
1387              'editingteacher' => CAP_ALLOW,
1388              'manager' => CAP_ALLOW
1389          ),
1390          'clonepermissionsfrom' =>  'moodle/question:manage'
1391      ),
1392      //END new in moodle 1.9
1393  
1394      // Configure the installed question types.
1395      'moodle/question:config' => array(
1396          'riskbitmask' => RISK_CONFIG,
1397          'captype' => 'write',
1398          'contextlevel' => CONTEXT_SYSTEM,
1399          'archetypes' => array(
1400              'manager' => CAP_ALLOW
1401          )
1402      ),
1403  
1404      // While attempting questions, the ability to flag particular questions for later reference.
1405      'moodle/question:flag' => array(
1406          'captype' => 'write',
1407          'contextlevel' => CONTEXT_COURSE,
1408          'archetypes' => array(
1409              'student' => CAP_ALLOW,
1410              'teacher' => CAP_ALLOW,
1411              'editingteacher' => CAP_ALLOW,
1412              'manager' => CAP_ALLOW
1413          )
1414      ),
1415  
1416      'moodle/site:doclinks' => array(
1417          'captype' => 'read',
1418          'contextlevel' => CONTEXT_SYSTEM,
1419          'archetypes' => array(
1420              'teacher' => CAP_ALLOW,
1421              'editingteacher' => CAP_ALLOW,
1422              'manager' => CAP_ALLOW
1423          )
1424      ),
1425  
1426      'moodle/course:sectionvisibility' => array(
1427  
1428          'captype' => 'write',
1429          'contextlevel' => CONTEXT_COURSE,
1430          'archetypes' => array(
1431              'editingteacher' => CAP_ALLOW,
1432              'manager' => CAP_ALLOW
1433          )
1434      ),
1435  
1436      'moodle/course:useremail' => array(
1437  
1438          'captype' => 'write',
1439          'contextlevel' => CONTEXT_COURSE,
1440          'archetypes' => array(
1441              'editingteacher' => CAP_ALLOW,
1442              'manager' => CAP_ALLOW
1443          )
1444      ),
1445  
1446      'moodle/course:viewhiddensections' => array(
1447  
1448          'captype' => 'write',
1449          'contextlevel' => CONTEXT_COURSE,
1450          'archetypes' => array(
1451              'editingteacher' => CAP_ALLOW,
1452              'manager' => CAP_ALLOW
1453          )
1454      ),
1455  
1456      'moodle/course:setcurrentsection' => array(
1457  
1458          'captype' => 'write',
1459          'contextlevel' => CONTEXT_COURSE,
1460          'archetypes' => array(
1461              'editingteacher' => CAP_ALLOW,
1462              'manager' => CAP_ALLOW
1463          )
1464      ),
1465  
1466      'moodle/course:movesections' => array(
1467  
1468          'captype' => 'write',
1469          'contextlevel' => CONTEXT_COURSE,
1470          'archetypes' => array(
1471              'editingteacher' => CAP_ALLOW,
1472              'manager' => CAP_ALLOW
1473          ),
1474          'clonepermissionsfrom' => 'moodle/course:update'
1475      ),
1476  
1477      'moodle/site:mnetlogintoremote' => array(
1478  
1479          'captype' => 'read',
1480          'contextlevel' => CONTEXT_SYSTEM,
1481          'archetypes' => array(
1482          )
1483      ),
1484  
1485      'moodle/grade:viewall' => array(
1486          'riskbitmask' => RISK_PERSONAL,
1487          'captype' => 'read',
1488          'contextlevel' => CONTEXT_COURSE, // and CONTEXT_USER
1489          'archetypes' => array(
1490              'teacher' => CAP_ALLOW,
1491              'editingteacher' => CAP_ALLOW,
1492              'manager' => CAP_ALLOW
1493          ),
1494          'clonepermissionsfrom' => 'moodle/course:viewcoursegrades'
1495      ),
1496  
1497      'moodle/grade:view' => array(
1498          'captype' => 'read',
1499          'contextlevel' => CONTEXT_COURSE,
1500          'archetypes' => array(
1501              'student' => CAP_ALLOW
1502          )
1503      ),
1504  
1505      'moodle/grade:viewhidden' => array(
1506          'riskbitmask' => RISK_PERSONAL,
1507          'captype' => 'read',
1508          'contextlevel' => CONTEXT_COURSE,
1509          'archetypes' => array(
1510              'teacher' => CAP_ALLOW,
1511              'editingteacher' => CAP_ALLOW,
1512              'manager' => CAP_ALLOW
1513          ),
1514          'clonepermissionsfrom' => 'moodle/course:viewcoursegrades'
1515      ),
1516  
1517      'moodle/grade:import' => array(
1518          'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1519          'captype' => 'write',
1520          'contextlevel' => CONTEXT_COURSE,
1521          'archetypes' => array(
1522              'editingteacher' => CAP_ALLOW,
1523              'manager' => CAP_ALLOW
1524          ),
1525          'clonepermissionsfrom' => 'moodle/course:managegrades'
1526      ),
1527  
1528      'moodle/grade:export' => array(
1529          'riskbitmask' => RISK_PERSONAL,
1530          'captype' => 'read',
1531          'contextlevel' => CONTEXT_COURSE,
1532          'archetypes' => array(
1533              'teacher' => CAP_ALLOW,
1534              'editingteacher' => CAP_ALLOW,
1535              'manager' => CAP_ALLOW
1536          ),
1537          'clonepermissionsfrom' => 'moodle/course:managegrades'
1538      ),
1539  
1540      'moodle/grade:manage' => array(
1541          'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1542          'captype' => 'write',
1543          'contextlevel' => CONTEXT_COURSE,
1544          'archetypes' => array(
1545              'editingteacher' => CAP_ALLOW,
1546              'manager' => CAP_ALLOW
1547          ),
1548          'clonepermissionsfrom' => 'moodle/course:managegrades'
1549      ),
1550  
1551      'moodle/grade:edit' => array(
1552          'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1553          'captype' => 'write',
1554          'contextlevel' => CONTEXT_COURSE,
1555          'archetypes' => array(
1556              'editingteacher' => CAP_ALLOW,
1557              'manager' => CAP_ALLOW
1558          ),
1559          'clonepermissionsfrom' => 'moodle/course:managegrades'
1560      ),
1561  
1562      // ability to define advanced grading forms in activities either from scratch
1563      // or from a shared template
1564      'moodle/grade:managegradingforms' => array(
1565          'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1566          'captype' => 'write',
1567          'contextlevel' => CONTEXT_COURSE,
1568          'archetypes' => array(
1569              'editingteacher' => CAP_ALLOW,
1570              'manager' => CAP_ALLOW
1571          ),
1572          'clonepermissionsfrom' => 'moodle/course:managegrades'
1573      ),
1574  
1575      // ability to save a grading form as a new shared template and eventually edit
1576      // and remove own templates (templates originally shared by that user)
1577      'moodle/grade:sharegradingforms' => array(
1578          'riskbitmask' => RISK_XSS,
1579          'captype' => 'write',
1580          'contextlevel' => CONTEXT_SYSTEM,
1581          'archetypes' => array(
1582              'manager' => CAP_ALLOW
1583          ),
1584      ),
1585  
1586      // ability to edit and remove any shared template, even those originally shared
1587      // by other users
1588      'moodle/grade:managesharedforms' => array(
1589          'riskbitmask' => RISK_XSS,
1590          'captype' => 'write',
1591          'contextlevel' => CONTEXT_SYSTEM,
1592          'archetypes' => array(
1593              'manager' => CAP_ALLOW
1594          ),
1595      ),
1596  
1597      'moodle/grade:manageoutcomes' => array(
1598          'captype' => 'write',
1599          'contextlevel' => CONTEXT_COURSE,
1600          'archetypes' => array(
1601              'editingteacher' => CAP_ALLOW,
1602              'manager' => CAP_ALLOW
1603          ),
1604          'clonepermissionsfrom' => 'moodle/course:managegrades'
1605      ),
1606  
1607      'moodle/grade:manageletters' => array(
1608          'captype' => 'write',
1609          'contextlevel' => CONTEXT_COURSE,
1610          'archetypes' => array(
1611              'editingteacher' => CAP_ALLOW,
1612              'manager' => CAP_ALLOW
1613          ),
1614          'clonepermissionsfrom' => 'moodle/course:managegrades'
1615      ),
1616  
1617      'moodle/grade:hide' => array(
1618          'captype' => 'write',
1619          'contextlevel' => CONTEXT_COURSE,
1620          'archetypes' => array(
1621              'editingteacher' => CAP_ALLOW,
1622              'manager' => CAP_ALLOW
1623          )
1624      ),
1625  
1626      'moodle/grade:lock' => array(
1627          'captype' => 'write',
1628          'contextlevel' => CONTEXT_COURSE,
1629          'archetypes' => array(
1630              'editingteacher' => CAP_ALLOW,
1631              'manager' => CAP_ALLOW
1632          )
1633      ),
1634  
1635      'moodle/grade:unlock' => array(
1636          'captype' => 'write',
1637          'contextlevel' => CONTEXT_COURSE,
1638          'archetypes' => array(
1639              'editingteacher' => CAP_ALLOW,
1640              'manager' => CAP_ALLOW
1641          )
1642      ),
1643  
1644      'moodle/my:manageblocks' => array(
1645          'captype' => 'write',
1646          'contextlevel' => CONTEXT_SYSTEM,
1647          'archetypes' => array(
1648              'user' => CAP_ALLOW
1649          )
1650      ),
1651  
1652      'moodle/notes:view' => array(
1653          'captype' => 'read',
1654          'contextlevel' => CONTEXT_COURSE,
1655          'archetypes' => array(
1656              'teacher' => CAP_ALLOW,
1657              'editingteacher' => CAP_ALLOW,
1658              'manager' => CAP_ALLOW
1659          )
1660      ),
1661  
1662      'moodle/notes:manage' => array(
1663          'riskbitmask' => RISK_SPAM,
1664  
1665          'captype' => 'write',
1666          'contextlevel' => CONTEXT_COURSE,
1667          'archetypes' => array(
1668              'teacher' => CAP_ALLOW,
1669              'editingteacher' => CAP_ALLOW,
1670              'manager' => CAP_ALLOW
1671          )
1672      ),
1673  
1674      'moodle/tag:manage' => array(
1675          'riskbitmask' => RISK_SPAM,
1676  
1677          'captype' => 'write',
1678          'contextlevel' => CONTEXT_SYSTEM,
1679          'archetypes' => array(
1680              'teacher' => CAP_ALLOW,
1681              'editingteacher' => CAP_ALLOW,
1682              'manager' => CAP_ALLOW
1683          )
1684      ),
1685  
1686      'moodle/tag:create' => array(
1687          'riskbitmask' => RISK_SPAM,
1688  
1689          'captype' => 'write',
1690          'contextlevel' => CONTEXT_SYSTEM,
1691          'archetypes' => array(
1692              'manager' => CAP_ALLOW,
1693              'user' => CAP_ALLOW
1694          )
1695      ),
1696  
1697      'moodle/tag:edit' => array(
1698          'riskbitmask' => RISK_SPAM,
1699  
1700          'captype' => 'write',
1701          'contextlevel' => CONTEXT_SYSTEM,
1702          'archetypes' => array(
1703              'manager' => CAP_ALLOW,
1704              'user' => CAP_ALLOW
1705          )
1706      ),
1707  
1708      'moodle/tag:flag' => array(
1709          'riskbitmask' => RISK_SPAM,
1710  
1711          'captype' => 'write',
1712          'contextlevel' => CONTEXT_SYSTEM,
1713          'archetypes' => array(
1714              'manager' => CAP_ALLOW,
1715              'user' => CAP_ALLOW
1716          )
1717      ),
1718  
1719      'moodle/tag:editblocks' => array(
1720          'captype' => 'write',
1721          'contextlevel' => CONTEXT_SYSTEM,
1722          'archetypes' => array(
1723              'teacher' => CAP_ALLOW,
1724              'editingteacher' => CAP_ALLOW,
1725              'manager' => CAP_ALLOW
1726          )
1727      ),
1728  
1729      'moodle/block:view' => array(
1730          'captype' => 'read',
1731          'contextlevel' => CONTEXT_BLOCK,
1732          'archetypes' => array(
1733              'guest' => CAP_ALLOW,
1734              'user' => CAP_ALLOW,
1735              'student' => CAP_ALLOW,
1736              'teacher' => CAP_ALLOW,
1737              'editingteacher' => CAP_ALLOW,
1738          )
1739      ),
1740  
1741      'moodle/block:edit' => array(
1742          'riskbitmask' => RISK_SPAM | RISK_XSS,
1743  
1744          'captype' => 'write',
1745          'contextlevel' => CONTEXT_BLOCK,
1746          'archetypes' => array(
1747              'editingteacher' => CAP_ALLOW,
1748              'manager' => CAP_ALLOW
1749          )
1750      ),
1751  
1752      'moodle/portfolio:export' => array(
1753          'captype' => 'read',
1754          'contextlevel' => CONTEXT_SYSTEM,
1755          'archetypes' => array(
1756              'user' => CAP_ALLOW,
1757              'student' => CAP_ALLOW,
1758              'teacher' => CAP_ALLOW,
1759              'editingteacher' => CAP_ALLOW,
1760          )
1761      ),
1762      'moodle/comment:view' => array(
1763          'captype' => 'read',
1764          'contextlevel' => CONTEXT_COURSE,
1765          'archetypes' => array(
1766              'frontpage' => CAP_ALLOW,
1767              'guest' => CAP_ALLOW,
1768              'user' => CAP_ALLOW,
1769              'student' => CAP_ALLOW,
1770              'teacher' => CAP_ALLOW,
1771              'editingteacher' => CAP_ALLOW,
1772              'manager' => CAP_ALLOW
1773          )
1774      ),
1775      'moodle/comment:post' => array(
1776  
1777          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1778          'captype' => 'write',
1779          'contextlevel' => CONTEXT_COURSE,
1780          'archetypes' => array(
1781              'user' => CAP_ALLOW,
1782              'student' => CAP_ALLOW,
1783              'teacher' => CAP_ALLOW,
1784              'editingteacher' => CAP_ALLOW,
1785              'manager' => CAP_ALLOW
1786          )
1787      ),
1788      'moodle/comment:delete' => array(
1789  
1790          'riskbitmask' => RISK_DATALOSS,
1791          'captype' => 'write',
1792          'contextlevel' => CONTEXT_COURSE,
1793          'archetypes' => array(
1794              'editingteacher' => CAP_ALLOW,
1795              'manager' => CAP_ALLOW
1796          )
1797      ),
1798      'moodle/webservice:createtoken' => array(
1799  
1800          'riskbitmask' => RISK_CONFIG | RISK_DATALOSS | RISK_SPAM | RISK_PERSONAL | RISK_XSS,
1801          'captype' => 'write',
1802          'contextlevel' => CONTEXT_SYSTEM,
1803          'archetypes' => array(
1804              'manager' => CAP_ALLOW
1805          )
1806      ),
1807      'moodle/webservice:createmobiletoken' => array(
1808  
1809          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1810          'captype' => 'write',
1811          'contextlevel' => CONTEXT_SYSTEM,
1812          'archetypes' => array(
1813              'user' => CAP_ALLOW
1814          )
1815      ),
1816      'moodle/rating:view' => array(
1817  
1818          'captype' => 'read',
1819          'contextlevel' => CONTEXT_COURSE,
1820          'archetypes' => array(
1821              'user' => CAP_ALLOW,
1822              'student' => CAP_ALLOW,
1823              'teacher' => CAP_ALLOW,
1824              'editingteacher' => CAP_ALLOW,
1825              'manager' => CAP_ALLOW
1826          )
1827      ),
1828      'moodle/rating:viewany' => array(
1829  
1830          'riskbitmask' => RISK_PERSONAL,
1831          'captype' => 'read',
1832          'contextlevel' => CONTEXT_COURSE,
1833          'archetypes' => array(
1834              'user' => CAP_ALLOW,
1835              'student' => CAP_ALLOW,
1836              'teacher' => CAP_ALLOW,
1837              'editingteacher' => CAP_ALLOW,
1838              'manager' => CAP_ALLOW
1839          )
1840      ),
1841      'moodle/rating:viewall' => array(
1842  
1843          'riskbitmask' => RISK_PERSONAL,
1844          'captype' => 'read',
1845          'contextlevel' => CONTEXT_COURSE,
1846          'archetypes' => array(
1847              'user' => CAP_ALLOW,
1848              'student' => CAP_ALLOW,
1849              'teacher' => CAP_ALLOW,
1850              'editingteacher' => CAP_ALLOW,
1851              'manager' => CAP_ALLOW
1852          )
1853      ),
1854      'moodle/rating:rate' => array(
1855  
1856          'captype' => 'write',
1857          'contextlevel' => CONTEXT_COURSE,
1858          'archetypes' => array(
1859              'user' => CAP_ALLOW,
1860              'student' => CAP_ALLOW,
1861              'teacher' => CAP_ALLOW,
1862              'editingteacher' => CAP_ALLOW,
1863              'manager' => CAP_ALLOW
1864          )
1865      ),
1866       'moodle/course:publish' => array(
1867  
1868          'captype' => 'write',
1869          'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1870          'contextlevel' => CONTEXT_SYSTEM,
1871          'archetypes' => array(
1872              'manager' => CAP_ALLOW
1873          )
1874      ),
1875      'moodle/course:markcomplete' => array(
1876          'captype' => 'write',
1877          'contextlevel' => CONTEXT_COURSE,
1878          'archetypes' => array(
1879              'teacher' => CAP_ALLOW,
1880              'editingteacher' => CAP_ALLOW,
1881              'manager' => CAP_ALLOW
1882          )
1883      ),
1884      'moodle/community:add' => array(
1885          'captype' => 'write',
1886          'contextlevel' => CONTEXT_SYSTEM,
1887          'archetypes' => array(
1888              'manager' => CAP_ALLOW,
1889              'teacher' => CAP_ALLOW,
1890              'editingteacher' => CAP_ALLOW,
1891          )
1892      ),
1893      'moodle/community:download' => array(
1894          'captype' => 'write',
1895          'contextlevel' => CONTEXT_SYSTEM,
1896          'archetypes' => array(
1897              'manager' => CAP_ALLOW,
1898              'editingteacher' => CAP_ALLOW,
1899          )
1900      ),
1901  
1902      // Badges.
1903      'moodle/badges:manageglobalsettings' => array(
1904          'riskbitmask'  => RISK_DATALOSS | RISK_CONFIG,
1905          'captype'      => 'write',
1906          'contextlevel' => CONTEXT_SYSTEM,
1907          'archetypes'   => array(
1908              'manager'       => CAP_ALLOW,
1909          )
1910      ),
1911  
1912      // View available badges without earning them.
1913      'moodle/badges:viewbadges' => array(
1914          'captype'       => 'read',
1915          'contextlevel'  => CONTEXT_COURSE,
1916          'archetypes'    => array(
1917              'user'          => CAP_ALLOW,
1918          )
1919      ),
1920  
1921      // Manage badges on own private badges page.
1922      'moodle/badges:manageownbadges' => array(
1923          'riskbitmap'    => RISK_SPAM,
1924          'captype'       => 'write',
1925          'contextlevel'  => CONTEXT_USER,
1926          'archetypes'    => array(
1927              'user'    => CAP_ALLOW
1928          )
1929      ),
1930  
1931      // View public badges in other users' profiles.
1932      'moodle/badges:viewotherbadges' => array(
1933          'riskbitmap'    => RISK_PERSONAL,
1934          'captype'       => 'read',
1935          'contextlevel'  => CONTEXT_USER,
1936          'archetypes'    => array(
1937              'user'    => CAP_ALLOW
1938          )
1939      ),
1940  
1941      // Earn badge.
1942      'moodle/badges:earnbadge' => array(
1943          'captype'       => 'write',
1944          'contextlevel'  => CONTEXT_COURSE,
1945          'archetypes'    => array(
1946              'user'           => CAP_ALLOW,
1947          )
1948      ),
1949  
1950      // Create/duplicate badges.
1951      'moodle/badges:createbadge' => array(
1952          'riskbitmask'  => RISK_SPAM,
1953          'captype'      => 'write',
1954          'contextlevel' => CONTEXT_COURSE,
1955          'archetypes'   => array(
1956              'manager'        => CAP_ALLOW,
1957              'editingteacher' => CAP_ALLOW,
1958          )
1959      ),
1960  
1961      // Delete badges.
1962      'moodle/badges:deletebadge' => array(
1963          'riskbitmask'  => RISK_DATALOSS,
1964          'captype'      => 'write',
1965          'contextlevel' => CONTEXT_COURSE,
1966          'archetypes'   => array(
1967              'manager'        => CAP_ALLOW,
1968              'editingteacher' => CAP_ALLOW,
1969          )
1970      ),
1971  
1972      // Set up/edit badge details.
1973      'moodle/badges:configuredetails' => array(
1974          'riskbitmask'  => RISK_SPAM,
1975          'captype'      => 'write',
1976          'contextlevel' => CONTEXT_COURSE,
1977          'archetypes'   => array(
1978              'manager'        => CAP_ALLOW,
1979              'editingteacher' => CAP_ALLOW,
1980          )
1981      ),
1982  
1983      // Set up/edit criteria of earning a badge.
1984      'moodle/badges:configurecriteria' => array(
1985          'captype'      => 'write',
1986          'contextlevel' => CONTEXT_COURSE,
1987          'archetypes'   => array(
1988              'manager'        => CAP_ALLOW,
1989              'editingteacher' => CAP_ALLOW,
1990          )
1991      ),
1992  
1993      // Configure badge messages.
1994      'moodle/badges:configuremessages' => array(
1995          'riskbitmask'  => RISK_SPAM,
1996          'captype'      => 'write',
1997          'contextlevel' => CONTEXT_COURSE,
1998          'archetypes'   => array(
1999              'manager'        => CAP_ALLOW,
2000              'editingteacher' => CAP_ALLOW,
2001          )
2002      ),
2003  
2004      // Award badge to a user.
2005      'moodle/badges:awardbadge' => array(
2006          'riskbitmask'  => RISK_SPAM,
2007          'captype'      => 'write',
2008          'contextlevel' => CONTEXT_COURSE,
2009          'archetypes'   => array(
2010              'manager'        => CAP_ALLOW,
2011              'teacher'        => CAP_ALLOW,
2012              'editingteacher' => CAP_ALLOW,
2013          )
2014      ),
2015  
2016      // View users who earned a specific badge without being able to award a badge.
2017      'moodle/badges:viewawarded' => array(
2018          'riskbitmask'  => RISK_PERSONAL,
2019          'captype'      => 'read',
2020          'contextlevel' => CONTEXT_COURSE,
2021          'archetypes'   => array(
2022                  'manager'        => CAP_ALLOW,
2023                  'teacher'        => CAP_ALLOW,
2024                  'editingteacher' => CAP_ALLOW,
2025          )
2026      ),
2027  
2028      'moodle/site:forcelanguage' => array(
2029          'captype' => 'read',
2030          'contextlevel' => CONTEXT_SYSTEM,
2031          'archetypes' => array(
2032          )
2033      )
2034  );


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1