MDL-13766, fixed repository instance name and configplugin language string
[moodle.git] / lib / db / access.php
1 <?php
2 //
3 // Capability definitions for Moodle core.
4 //
5 // The capabilities are loaded into the database table when the module is
6 // installed or updated. Whenever the capability definitions are updated,
7 // the module version number should be bumped up.
8 //
9 // The system has four possible values for a capability:
10 // CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
11 //
12 //
13 // CAPABILITY NAMING CONVENTION
14 //
15 // It is important that capability names are unique. The naming convention
16 // for capabilities that are specific to modules and blocks is as follows:
17 //   [mod/block]/<plugin_name>:<capabilityname>
18 //
19 // component_name should be the same as the directory name of the mod or block.
20 //
21 // Core moodle capabilities are defined thus:
22 //    moodle/<capabilityclass>:<capabilityname>
23 //
24 // Examples: mod/forum:viewpost
25 //           block/recent_activity:view
26 //           moodle/site:deleteuser
27 //
28 // The variable name for the capability definitions array is $capabilities
31 $capabilities = array(
32     'moodle/site:config' => array(
34         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
36         'captype' => 'write',
37         'contextlevel' => CONTEXT_SYSTEM,
38         'archetypes' => array(
39         )
40     ),
42     'moodle/site:readallmessages' => array(
44         'riskbitmask' => RISK_PERSONAL,
46         'captype' => 'read',
47         'contextlevel' => CONTEXT_SYSTEM,
48         'archetypes' => array(
49             'manager' => CAP_ALLOW,
50             'editingteacher' => CAP_ALLOW
51         )
52     ),
54     'moodle/site:sendmessage' => array(
56         'riskbitmask' => RISK_SPAM,
58         'captype' => 'write',
59         'contextlevel' => CONTEXT_SYSTEM,
60         'archetypes' => array(
61             'manager' => CAP_ALLOW,
62             'user' => CAP_ALLOW
63         )
64     ),
66     'moodle/site:approvecourse' => array(
68         'riskbitmask' => RISK_XSS,
70         'captype' => 'write',
71         'contextlevel' => CONTEXT_SYSTEM,
72         'archetypes' => array(
73             'manager' => CAP_ALLOW
74         )
75     ),
77     'moodle/backup:backupcourse' => array(
79         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
81         'captype' => 'write',
82         'contextlevel' => CONTEXT_COURSE,
83         'archetypes' => array(
84             'editingteacher' => CAP_ALLOW,
85             'manager' => CAP_ALLOW
86         ),
88         'clonepermissionsfrom' =>  'moodle/site:backup'
89     ),
91     'moodle/backup:backupsection' => array(
93         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
95         'captype' => 'write',
96         'contextlevel' => CONTEXT_COURSE,
97         'archetypes' => array(
98             'editingteacher' => CAP_ALLOW,
99             'manager' => CAP_ALLOW
100         ),
102         'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
103     ),
105     'moodle/backup:backupactivity' => array(
107         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
109         'captype' => 'write',
110         'contextlevel' => CONTEXT_MODULE,
111         'archetypes' => array(
112             'editingteacher' => CAP_ALLOW,
113             'manager' => CAP_ALLOW
114         ),
116         'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
117     ),
119     'moodle/backup:backuptargethub' => array(
121         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
123         'captype' => 'write',
124         'contextlevel' => CONTEXT_COURSE,
125         'archetypes' => array(
126             'editingteacher' => CAP_ALLOW,
127             'manager' => CAP_ALLOW
128         ),
130         'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
131     ),
133     'moodle/backup:backuptargetimport' => array(
135         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
137         'captype' => 'write',
138         'contextlevel' => CONTEXT_COURSE,
139         'archetypes' => array(
140             'editingteacher' => CAP_ALLOW,
141             'manager' => CAP_ALLOW
142         ),
144         'clonepermissionsfrom' =>  'moodle/backup:backupcourse'
145     ),
147     'moodle/backup:downloadfile' => array(
149         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
151         'captype' => 'write',
152         'contextlevel' => CONTEXT_COURSE,
153         'archetypes' => array(
154             'editingteacher' => CAP_ALLOW,
155             'manager' => CAP_ALLOW
156         ),
158         'clonepermissionsfrom' =>  'moodle/site:backupdownload'
159     ),
161     'moodle/backup:configure' => array(
163         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
165         'captype' => 'write',
166         'contextlevel' => CONTEXT_COURSE,
167         'archetypes' => array(
168             'editingteacher' => CAP_ALLOW,
169             'manager' => CAP_ALLOW
170         )
171     ),
173     'moodle/backup:userinfo' => array(
175         'riskbitmask' => RISK_PERSONAL,
177         'captype' => 'read',
178         'contextlevel' => CONTEXT_COURSE,
179         'archetypes' => array(
180             'manager' => CAP_ALLOW
181         )
182     ),
184     'moodle/backup:anonymise' => array(
186         'riskbitmask' => RISK_PERSONAL,
188         'captype' => 'read',
189         'contextlevel' => CONTEXT_COURSE,
190         'archetypes' => array(
191             'manager' => CAP_ALLOW
192         )
193     ),
195     'moodle/restore:restorecourse' => array(
197         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
199         'captype' => 'write',
200         'contextlevel' => CONTEXT_COURSE,
201         'archetypes' => array(
202             'editingteacher' => CAP_ALLOW,
203             'manager' => CAP_ALLOW
204         ),
206         'clonepermissionsfrom' =>  'moodle/site:restore'
207     ),
209     'moodle/restore:restoresection' => array(
211         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
213         'captype' => 'write',
214         'contextlevel' => CONTEXT_COURSE,
215         'archetypes' => array(
216             'editingteacher' => CAP_ALLOW,
217             'manager' => CAP_ALLOW
218         ),
220         'clonepermissionsfrom' =>  'moodle/restore:restorecourse'
221     ),
223     'moodle/restore:restoreactivity' => array(
225         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
227         'captype' => 'write',
228         'contextlevel' => CONTEXT_MODULE,
229         'archetypes' => array(
230             'editingteacher' => CAP_ALLOW,
231             'manager' => CAP_ALLOW
232         ),
234         'clonepermissionsfrom' =>  'moodle/restore:restorecourse'
235     ),
237     'moodle/restore:restoretargethub' => array(
239         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
241         'captype' => 'write',
242         'contextlevel' => CONTEXT_COURSE,
243         'archetypes' => array(
244             'editingteacher' => CAP_ALLOW,
245             'manager' => CAP_ALLOW
246         ),
248         'clonepermissionsfrom' =>  'moodle/restore:restorecourse'
249     ),
251     'moodle/restore:restoretargetimport' => array(
253         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
255         'captype' => 'write',
256         'contextlevel' => CONTEXT_COURSE,
257         'archetypes' => array(
258             'editingteacher' => CAP_ALLOW,
259             'manager' => CAP_ALLOW
260         ),
262         'clonepermissionsfrom' =>  'moodle/site:import'
263     ),
265     'moodle/restore:uploadfile' => array(
267         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
269         'captype' => 'write',
270         'contextlevel' => CONTEXT_COURSE,
271         'archetypes' => array(
272             'editingteacher' => CAP_ALLOW,
273             'manager' => CAP_ALLOW
274         ),
276         'clonepermissionsfrom' =>  'moodle/site:backupupload'
277     ),
279     'moodle/restore:configure' => array(
281         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
283         'captype' => 'write',
284         'contextlevel' => CONTEXT_COURSE,
285         'archetypes' => array(
286             'editingteacher' => CAP_ALLOW,
287             'manager' => CAP_ALLOW
288         )
289     ),
291     'moodle/restore:rolldates' => array(
293         'captype' => 'write',
294         'contextlevel' => CONTEXT_COURSE,
295         'archetypes' => array(
296             'coursecreator' => CAP_ALLOW,
297             'manager' => CAP_ALLOW
298         )
299     ),
301     'moodle/restore:userinfo' => array(
303         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
305         'captype' => 'write',
306         'contextlevel' => CONTEXT_COURSE,
307         'archetypes' => array(
308             'manager' => CAP_ALLOW
309         )
310     ),
312     'moodle/restore:createuser' => array(
314         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
316         'captype' => 'write',
317         'contextlevel' => CONTEXT_SYSTEM,
318         'archetypes' => array(
319             'manager' => CAP_ALLOW
320         )
321     ),
323     'moodle/site:manageblocks' => array(
325         'riskbitmask' => RISK_SPAM | RISK_XSS,
327         'captype' => 'write',
328         'contextlevel' => CONTEXT_BLOCK,
329         'archetypes' => array(
330             'editingteacher' => CAP_ALLOW,
331             'manager' => CAP_ALLOW
332         )
333     ),
335     'moodle/site:accessallgroups' => array(
337         'captype' => 'read',
338         'contextlevel' => CONTEXT_COURSE,
339         'archetypes' => array(
340             'teacher' => CAP_ALLOW,
341             'editingteacher' => CAP_ALLOW,
342             'manager' => CAP_ALLOW
343         )
344     ),
346     'moodle/site:viewfullnames' => array(
348         'captype' => 'read',
349         'contextlevel' => CONTEXT_COURSE,
350         'archetypes' => array(
351             'teacher' => CAP_ALLOW,
352             'editingteacher' => CAP_ALLOW,
353             'manager' => CAP_ALLOW
354         )
355     ),
357     'moodle/site:viewreports' => array(
359         'riskbitmask' => RISK_PERSONAL,
361         'captype' => 'read',
362         'contextlevel' => CONTEXT_COURSE,
363         'archetypes' => array(
364             'teacher' => CAP_ALLOW,
365             'editingteacher' => CAP_ALLOW,
366             'manager' => CAP_ALLOW
367         )
368     ),
370     'moodle/site:trustcontent' => array(
372         'riskbitmask' => RISK_XSS,
374         'captype' => 'write',
375         'contextlevel' => CONTEXT_COURSE,
376         'archetypes' => array(
377             'editingteacher' => CAP_ALLOW,
378             'manager' => CAP_ALLOW
379         )
380     ),
382     'moodle/site:uploadusers' => array(
384         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
386         'captype' => 'write',
387         'contextlevel' => CONTEXT_SYSTEM,
388         'archetypes' => array(
389             'manager' => CAP_ALLOW
390         )
391     ),
393     'moodle/site:langeditmaster' => array(
395         'riskbitmask' => RISK_CONFIG | RISK_XSS,
397         'captype' => 'write',
398         'contextlevel' => CONTEXT_SYSTEM,
399         'archetypes' => array(
400         )
401     ),
403     'moodle/site:langeditlocal' => array(
405         'riskbitmask' => RISK_CONFIG | RISK_XSS,
407         'captype' => 'write',
408         'contextlevel' => CONTEXT_SYSTEM,
409         'archetypes' => array(
410             'manager' => CAP_ALLOW
411         )
412     ),
414     // Permission to manage filter setting overrides in subcontexts.
415     'moodle/filter:manage' => array(
417         'captype' => 'write',
418         'contextlevel' => CONTEXT_COURSE,
419         'archetypes' => array(
420             'editingteacher' => CAP_ALLOW,
421             'coursecreator' => CAP_ALLOW,
422             'manager' => CAP_ALLOW,
423         )
424     ),
426     'moodle/user:create' => array(
428         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
430         'captype' => 'write',
431         'contextlevel' => CONTEXT_SYSTEM,
432         'archetypes' => array(
433             'manager' => CAP_ALLOW
434         )
435     ),
437     'moodle/user:delete' => array(
439         'riskbitmask' => RISK_PERSONAL, RISK_DATALOSS,
441         'captype' => 'write',
442         'contextlevel' => CONTEXT_SYSTEM,
443         'archetypes' => array(
444             'manager' => CAP_ALLOW
445         )
446     ),
448     'moodle/user:update' => array(
450         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
452         'captype' => 'write',
453         'contextlevel' => CONTEXT_SYSTEM,
454         'archetypes' => array(
455             'manager' => CAP_ALLOW
456         )
457     ),
459     'moodle/user:viewdetails' => array(
461         'captype' => 'read',
462         'contextlevel' => CONTEXT_COURSE,
463         'archetypes' => array(
464             'guest' => CAP_ALLOW,
465             'student' => CAP_ALLOW,
466             'teacher' => CAP_ALLOW,
467             'editingteacher' => CAP_ALLOW,
468             'manager' => CAP_ALLOW
469         )
470     ),
472     'moodle/user:viewhiddendetails' => array(
474         'riskbitmask' => RISK_PERSONAL,
476         'captype' => 'read',
477         'contextlevel' => CONTEXT_COURSE,
478         'archetypes' => array(
479             'teacher' => CAP_ALLOW,
480             'editingteacher' => CAP_ALLOW,
481             'manager' => CAP_ALLOW
482         )
483     ),
485     'moodle/user:loginas' => array(
487         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
489         'captype' => 'write',
490         'contextlevel' => CONTEXT_COURSE,
491         'archetypes' => array(
492             'manager' => CAP_ALLOW
493         )
494     ),
496     // can the user manage the system default profile page?
497     'moodle/user:managesyspages' => array(
499         'riskbitmap' => RISK_SPAM | RISK_PERSONAL | RISK_CONFIG,
501         'captype' => 'write',
502         'contextlevel' => CONTEXT_SYSTEM,
503         'archetypes' => array(
504             'manager' => CAP_ALLOW
505         )
506     ),
508     // can the user manage another user's profile page?
509     'moodle/user:manageblocks' => array(
511         'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
513         'captype' => 'write',
514         'contextlevel' => CONTEXT_USER
515     ),
517     // can the user manage their own profile page?
518     'moodle/user:manageownblocks' => array(
520         'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
522         'captype' => 'write',
523         'contextlevel' => CONTEXT_SYSTEM,
524         'archetypes' => array(
525             'user' => CAP_ALLOW
526         )
527     ),
529     // can the user manage their own files?
530     'moodle/user:manageownfiles' => array(
532         'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
534         'captype' => 'write',
535         'contextlevel' => CONTEXT_SYSTEM,
536         'archetypes' => array(
537             'user' => CAP_ALLOW
538         )
539     ),
541     // can the user manage the system default dashboard page?
542     'moodle/my:configsyspages' => array(
544         'riskbitmap' => RISK_SPAM | RISK_PERSONAL | RISK_CONFIG,
546         'captype' => 'write',
547         'contextlevel' => CONTEXT_SYSTEM,
548         'archetypes' => array(
549             'manager' => CAP_ALLOW
550         )
551     ),
553     'moodle/role:assign' => array(
555         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
557         'captype' => 'write',
558         'contextlevel' => CONTEXT_COURSE,
559         'archetypes' => array(
560             'editingteacher' => CAP_ALLOW,
561             'manager' => CAP_ALLOW
562         )
563     ),
565     'moodle/role:review' => array(
567         'riskbitmask' => RISK_PERSONAL,
569         'captype' => 'read',
570         'contextlevel' => CONTEXT_COURSE,
571         'archetypes' => array(
572             'teacher' => CAP_ALLOW,
573             'editingteacher' => CAP_ALLOW,
574             'manager' => CAP_ALLOW
575         )
576     ),
578     'moodle/role:override' => array(
580         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
582         'captype' => 'write',
583         'contextlevel' => CONTEXT_COURSE,
584         'archetypes' => array(
585             'manager' => CAP_ALLOW
586         )
587     ),
589     'moodle/role:safeoverride' => array(
591         'riskbitmask' => RISK_SPAM,
593         'captype' => 'write',
594         'contextlevel' => CONTEXT_COURSE,
595         'archetypes' => array(
596             'editingteacher' => CAP_ALLOW
597         )
598     ),
600     'moodle/role:manage' => array(
602         'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
604         'captype' => 'write',
605         'contextlevel' => CONTEXT_SYSTEM,
606         'archetypes' => array(
607             'manager' => CAP_ALLOW
608         )
609     ),
611     'moodle/role:switchroles' => array(
613         'riskbitmask' => RISK_XSS | RISK_PERSONAL,
615         'captype' => 'read',
616         'contextlevel' => CONTEXT_COURSE,
617         'archetypes' => array(
618             'editingteacher' => CAP_ALLOW,
619             'manager' => CAP_ALLOW
620         )
621     ),
623     // Create, update and delete course categories. (Deleting a course category
624     // does not let you delete the courses it contains, unless you also have
625     // moodle/course: delete.) Creating and deleting requires this permission in
626     // the parent category.
627     'moodle/category:manage' => array(
629         'riskbitmask' => RISK_XSS,
631         'captype' => 'write',
632         'contextlevel' => CONTEXT_COURSECAT,
633         'archetypes' => array(
634             'manager' => CAP_ALLOW
635         ),
636         'clonepermissionsfrom' => 'moodle/category:update'
637     ),
639     'moodle/category:viewhiddencategories' => array(
641         'captype' => 'read',
642         'contextlevel' => CONTEXT_COURSECAT,
643         'archetypes' => array(
644             'coursecreator' => CAP_ALLOW,
645             'manager' => CAP_ALLOW
646         ),
647         'clonepermissionsfrom' => 'moodle/category:visibility'
648     ),
650     // create, delete, move cohorts in system and course categories,
651     // (cohorts with component !== null can be only moved)
652     'moodle/cohort:manage' => array(
654         'captype' => 'write',
655         'contextlevel' => CONTEXT_COURSECAT,
656         'archetypes' => array(
657             'manager' => CAP_ALLOW
658         )
659     ),
661     // add and remove cohort members (only for cohorts where component !== null)
662     'moodle/cohort:assign' => array(
664         'captype' => 'write',
665         'contextlevel' => CONTEXT_COURSECAT,
666         'archetypes' => array(
667             'manager' => CAP_ALLOW
668         )
669     ),
671     // view members of a cohort, this can be used in course context too,
672     // this also controls the ability to actually use cohort
673     'moodle/cohort:view' => array(
675         'captype' => 'read',
676         'contextlevel' => CONTEXT_COURSE,
677         'archetypes' => array(
678             'editingteacher' => CAP_ALLOW,
679             'manager' => CAP_ALLOW
680         )
681     ),
683     'moodle/course:create' => array(
685         'riskbitmask' => RISK_XSS,
687         'captype' => 'write',
688         'contextlevel' => CONTEXT_COURSECAT,
689         'archetypes' => array(
690             'coursecreator' => CAP_ALLOW,
691             'manager' => CAP_ALLOW
692         )
693     ),
695     'moodle/course:request' => array(
696         'captype' => 'write',
697         'contextlevel' => CONTEXT_SYSTEM,
698         'archetypes' => array(
699             'user' => CAP_ALLOW,
700         )
701     ),
703     'moodle/course:delete' => array(
705         'riskbitmask' => RISK_DATALOSS,
707         'captype' => 'write',
708         'contextlevel' => CONTEXT_COURSE,
709         'archetypes' => array(
710             'editingteacher' => CAP_ALLOW,
711             'manager' => CAP_ALLOW
712         )
713     ),
715     'moodle/course:update' => array(
717         'riskbitmask' => RISK_XSS,
719         'captype' => 'write',
720         'contextlevel' => CONTEXT_COURSE,
721         'archetypes' => array(
722             'editingteacher' => CAP_ALLOW,
723             'manager' => CAP_ALLOW
724         )
725     ),
727     'moodle/course:view' => array(
729         'captype' => 'read',
730         'contextlevel' => CONTEXT_COURSE,
731         'archetypes' => array(
732             'manager' => CAP_ALLOW,
733         )
734     ),
736     /* review course enrolments - no group restrictions, it is really full access to all participants info*/
737     'moodle/course:enrolreview' => array(
739         'riskbitmask' => RISK_PERSONAL,
741         'captype' => 'read',
742         'contextlevel' => CONTEXT_COURSE,
743         'archetypes' => array(
744             'editingteacher' => CAP_ALLOW,
745             'manager' => CAP_ALLOW,
746         )
747     ),
749     /* add, remove, hide enrol instances in courses */
750     'moodle/course:enrolconfig' => array(
752         'riskbitmask' => RISK_PERSONAL,
754         'captype' => 'write',
755         'contextlevel' => CONTEXT_COURSE,
756         'archetypes' => array(
757             'editingteacher' => CAP_ALLOW,
758             'manager' => CAP_ALLOW,
759         )
760     ),
762     'moodle/course:bulkmessaging' => array(
764         'riskbitmask' => RISK_SPAM,
766         'captype' => 'write',
767         'contextlevel' => CONTEXT_COURSE,
768         'archetypes' => array(
769             'teacher' => CAP_ALLOW,
770             'editingteacher' => CAP_ALLOW,
771             'manager' => CAP_ALLOW
772         )
773     ),
775     'moodle/course:viewhiddenuserfields' => array(
777         'riskbitmask' => RISK_PERSONAL,
779         'captype' => 'read',
780         'contextlevel' => CONTEXT_COURSE,
781         'archetypes' => array(
782             'teacher' => CAP_ALLOW,
783             'editingteacher' => CAP_ALLOW,
784             'manager' => CAP_ALLOW
785         )
786     ),
788     'moodle/course:viewhiddencourses' => array(
790         'captype' => 'read',
791         'contextlevel' => CONTEXT_COURSE,
792         'archetypes' => array(
793             'coursecreator' => CAP_ALLOW,
794             'teacher' => CAP_ALLOW,
795             'editingteacher' => CAP_ALLOW,
796             'manager' => CAP_ALLOW
797         )
798     ),
800     'moodle/course:visibility' => array(
802         'captype' => 'write',
803         'contextlevel' => CONTEXT_COURSE,
804         'archetypes' => array(
805             'editingteacher' => CAP_ALLOW,
806             'manager' => CAP_ALLOW
807         )
808     ),
810     'moodle/course:managefiles' => array(
812         'riskbitmask' => RISK_XSS,
814         'captype' => 'write',
815         'contextlevel' => CONTEXT_COURSE,
816         'archetypes' => array(
817             'editingteacher' => CAP_ALLOW,
818             'manager' => CAP_ALLOW
819         )
820     ),
822     'moodle/course:manageactivities' => array(
824         'riskbitmask' => RISK_XSS,
826         'captype' => 'write',
827         'contextlevel' => CONTEXT_COURSE,
828         'archetypes' => array(
829             'editingteacher' => CAP_ALLOW,
830             'manager' => CAP_ALLOW
831         )
832     ),
834     'moodle/course:activityvisibility' => array(
836         'captype' => 'write',
837         'contextlevel' => CONTEXT_COURSE,
838         'archetypes' => array(
839             'editingteacher' => CAP_ALLOW,
840             'manager' => CAP_ALLOW
841         )
842     ),
844     'moodle/course:viewhiddenactivities' => array(
846         'captype' => 'write',
847         'contextlevel' => CONTEXT_COURSE,
848         'archetypes' => array(
849             'teacher' => CAP_ALLOW,
850             'editingteacher' => CAP_ALLOW,
851             'manager' => CAP_ALLOW
852         )
853     ),
855     'moodle/course:viewparticipants' => array(
857         'captype' => 'read',
858         'contextlevel' => CONTEXT_COURSE,
859         'archetypes' => array(
860             'student' => CAP_ALLOW,
861             'teacher' => CAP_ALLOW,
862             'editingteacher' => CAP_ALLOW,
863             'manager' => CAP_ALLOW
864         )
865     ),
867     'moodle/course:changefullname' => array(
869         'riskbitmask' => RISK_XSS,
871         'captype' => 'write',
872         'contextlevel' => CONTEXT_COURSE,
873         'archetypes' => array(
874             'editingteacher' => CAP_ALLOW,
875             'manager' => CAP_ALLOW
876         ),
877         'clonepermissionsfrom' => 'moodle/course:update'
878     ),
880     'moodle/course:changeshortname' => array(
882         'riskbitmask' => RISK_XSS,
884         'captype' => 'write',
885         'contextlevel' => CONTEXT_COURSE,
886         'archetypes' => array(
887             'editingteacher' => CAP_ALLOW,
888             'manager' => CAP_ALLOW
889         ),
890         'clonepermissionsfrom' => 'moodle/course:update'
891     ),
893     'moodle/course:changeidnumber' => array(
895         'riskbitmask' => RISK_XSS,
897         'captype' => 'write',
898         'contextlevel' => CONTEXT_COURSE,
899         'archetypes' => array(
900             'editingteacher' => CAP_ALLOW,
901             'manager' => CAP_ALLOW
902         ),
903         'clonepermissionsfrom' => 'moodle/course:update'
904     ),
905     'moodle/course:changecategory' => array(
906         'riskbitmask' => RISK_XSS,
908         'captype' => 'write',
909         'contextlevel' => CONTEXT_COURSE,
910         'archetypes' => array(
911             'editingteacher' => CAP_ALLOW,
912             'manager' => CAP_ALLOW
913         ),
914         'clonepermissionsfrom' => 'moodle/course:update'
915     ),
917     'moodle/course:changesummary' => array(
918         'riskbitmask' => RISK_XSS,
920         'captype' => 'write',
921         'contextlevel' => CONTEXT_COURSE,
922         'archetypes' => array(
923             'editingteacher' => CAP_ALLOW,
924             'manager' => CAP_ALLOW
925         ),
926         'clonepermissionsfrom' => 'moodle/course:update'
927     ),
930     'moodle/site:viewparticipants' => array(
932         'captype' => 'read',
933         'contextlevel' => CONTEXT_SYSTEM,
934         'archetypes' => array(
935             'manager' => CAP_ALLOW
936         )
937     ),
939     'moodle/course:viewscales' => array(
941         'captype' => 'read',
942         'contextlevel' => CONTEXT_COURSE,
943         'archetypes' => array(
944             'student' => CAP_ALLOW,
945             'teacher' => CAP_ALLOW,
946             'editingteacher' => CAP_ALLOW,
947             'manager' => CAP_ALLOW
948         )
949     ),
951     'moodle/course:managescales' => array(
953         'captype' => 'write',
954         'contextlevel' => CONTEXT_COURSE,
955         'archetypes' => array(
956             'editingteacher' => CAP_ALLOW,
957             'manager' => CAP_ALLOW
958         )
959     ),
961     'moodle/course:managegroups' => array(
963         'captype' => 'write',
964         'contextlevel' => CONTEXT_COURSE,
965         'archetypes' => array(
966             'editingteacher' => CAP_ALLOW,
967             'manager' => CAP_ALLOW
968         )
969     ),
971     'moodle/course:reset' => array(
973         'riskbitmask' => RISK_DATALOSS,
975         'captype' => 'write',
976         'contextlevel' => CONTEXT_COURSE,
977         'archetypes' => array(
978             'editingteacher' => CAP_ALLOW,
979             'manager' => CAP_ALLOW
980         )
981     ),
983     'moodle/blog:view' => array(
985         'captype' => 'read',
986         'contextlevel' => CONTEXT_SYSTEM,
987         'archetypes' => array(
988             'guest' => CAP_ALLOW,
989             'user' => CAP_ALLOW,
990             'student' => CAP_ALLOW,
991             'teacher' => CAP_ALLOW,
992             'editingteacher' => CAP_ALLOW,
993             'manager' => CAP_ALLOW
994         )
995     ),
997     'moodle/blog:search' => array(
998         'captype' => 'read',
999         'contextlevel' => CONTEXT_SYSTEM,
1000         'archetypes' => array(
1001             'guest' => CAP_ALLOW,
1002             'user' => CAP_ALLOW,
1003             'student' => CAP_ALLOW,
1004             'teacher' => CAP_ALLOW,
1005             'editingteacher' => CAP_ALLOW,
1006             'manager' => CAP_ALLOW
1007         )
1008     ),
1010     'moodle/blog:viewdrafts' => array(
1012         'riskbitmask' => RISK_PERSONAL,
1013         'captype' => 'read',
1014         'contextlevel' => CONTEXT_SYSTEM,
1015         'archetypes' => array(
1016             'manager' => CAP_ALLOW
1017         )
1018     ),
1020     'moodle/blog:create' => array( // works in CONTEXT_SYSTEM only
1022         'riskbitmask' => RISK_SPAM,
1024         'captype' => 'write',
1025         'contextlevel' => CONTEXT_SYSTEM,
1026         'archetypes' => array(
1027             'user' => CAP_ALLOW,
1028             'manager' => CAP_ALLOW
1029         )
1030     ),
1032     'moodle/blog:manageentries' => array(
1034         'riskbitmask' => RISK_SPAM,
1036         'captype' => 'write',
1037         'contextlevel' => CONTEXT_SYSTEM,
1038         'archetypes' => array(
1039             'teacher' => CAP_ALLOW,
1040             'editingteacher' => CAP_ALLOW,
1041             'manager' => CAP_ALLOW
1042         )
1043     ),
1045     'moodle/blog:manageexternal' => array(
1047         'riskbitmask' => RISK_SPAM,
1049         'captype' => 'write',
1050         'contextlevel' => CONTEXT_USER,
1051         'archetypes' => array(
1052             'student' => CAP_ALLOW,
1053             'user' => CAP_ALLOW,
1054             'teacher' => CAP_ALLOW,
1055             'editingteacher' => CAP_ALLOW,
1056             'manager' => CAP_ALLOW
1057         )
1058     ),
1060     'moodle/blog:associatecourse' => array(
1062         'captype' => 'write',
1063         'contextlevel' => CONTEXT_COURSE,
1064         'archetypes' => array(
1065             'student' => CAP_ALLOW,
1066             'user' => CAP_ALLOW,
1067             'teacher' => CAP_ALLOW,
1068             'editingteacher' => CAP_ALLOW,
1069             'manager' => CAP_ALLOW
1070         )
1071     ),
1073     'moodle/blog:associatemodule' => array(
1075         'captype' => 'write',
1076         'contextlevel' => CONTEXT_MODULE,
1077         'archetypes' => array(
1078             'student' => CAP_ALLOW,
1079             'user' => CAP_ALLOW,
1080             'teacher' => CAP_ALLOW,
1081             'editingteacher' => CAP_ALLOW,
1082             'manager' => CAP_ALLOW
1083         )
1084     ),
1086     'moodle/calendar:manageownentries' => array( // works in CONTEXT_SYSTEM only
1088         'riskbitmask' => RISK_SPAM,
1090         'captype' => 'write',
1091         'contextlevel' => CONTEXT_COURSE,
1092         'archetypes' => array(
1093             'user' => CAP_ALLOW,
1094             'manager' => CAP_ALLOW
1095         )
1096     ),
1098     'moodle/calendar:managegroupentries' => array(
1100         'riskbitmask' => RISK_SPAM,
1102         'captype' => 'write',
1103         'contextlevel' => CONTEXT_COURSE,
1104         'archetypes' => array(
1105             'teacher' => CAP_ALLOW,
1106             'editingteacher' => CAP_ALLOW,
1107             'manager' => CAP_ALLOW
1108         )
1109     ),
1111     'moodle/calendar:manageentries' => array(
1113         'riskbitmask' => RISK_SPAM,
1115         'captype' => 'write',
1116         'contextlevel' => CONTEXT_COURSE,
1117         'archetypes' => array(
1118             'teacher' => CAP_ALLOW,
1119             'editingteacher' => CAP_ALLOW,
1120             'manager' => CAP_ALLOW
1121         )
1122     ),
1124     'moodle/user:editprofile' => array(
1126         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1128         'captype' => 'write',
1129         'contextlevel' => CONTEXT_USER,
1130         'archetypes' => array(
1131             'manager' => CAP_ALLOW
1132         )
1133     ),
1135     'moodle/user:editownprofile' => array(
1137         'riskbitmask' => RISK_SPAM,
1139         'captype' => 'write',
1140         'contextlevel' => CONTEXT_SYSTEM,
1141         'archetypes' => array(
1142             'guest' => CAP_PROHIBIT,
1143             'user' => CAP_ALLOW,
1144             'manager' => CAP_ALLOW
1145         )
1146     ),
1148     'moodle/user:changeownpassword' => array(
1150         'captype' => 'write',
1151         'contextlevel' => CONTEXT_SYSTEM,
1152         'archetypes' => array(
1153             'guest' => CAP_PROHIBIT,
1154             'user' => CAP_ALLOW,
1155             'manager' => CAP_ALLOW
1156         )
1157     ),
1159     // The next 3 might make no sense for some roles, e.g teacher, etc.
1160     // since the next level up is site. These are more for the parent role
1161     'moodle/user:readuserposts' => array(
1163         'captype' => 'read',
1164         'contextlevel' => CONTEXT_USER,
1165         'archetypes' => array(
1166             'student' => CAP_ALLOW,
1167             'teacher' => CAP_ALLOW,
1168             'editingteacher' => CAP_ALLOW,
1169             'manager' => CAP_ALLOW
1170         )
1171     ),
1173     'moodle/user:readuserblogs' => array(
1175         'captype' => 'read',
1176         'contextlevel' => CONTEXT_USER,
1177         'archetypes' => array(
1178             'student' => CAP_ALLOW,
1179             'teacher' => CAP_ALLOW,
1180             'editingteacher' => CAP_ALLOW,
1181             'manager' => CAP_ALLOW
1182         )
1183     ),
1185     // designed for parent role - not used in legacy roles
1186     'moodle/user:viewuseractivitiesreport' => array(
1187         'riskbitmask' => RISK_PERSONAL,
1189         'captype' => 'read',
1190         'contextlevel' => CONTEXT_USER,
1191         'archetypes' => array(
1192         )
1193     ),
1195     //capabilities designed for the new message system configuration
1196     'moodle/user:editmessageprofile' => array(
1198          'riskbitmask' => RISK_SPAM,
1200          'captype' => 'write',
1201          'contextlevel' => CONTEXT_USER,
1202          'archetypes' => array(
1203              'manager' => CAP_ALLOW
1204          )
1205      ),
1207      'moodle/user:editownmessageprofile' => array(
1209          'captype' => 'write',
1210          'contextlevel' => CONTEXT_SYSTEM,
1211          'archetypes' => array(
1212              'guest' => CAP_PROHIBIT,
1213              'user' => CAP_ALLOW,
1214              'manager' => CAP_ALLOW
1215          )
1216      ),
1218     'moodle/question:managecategory' => array(
1219         'riskbitmask' => RISK_SPAM | RISK_XSS,
1220         'captype' => 'write',
1221         'contextlevel' => CONTEXT_COURSE,
1222         'archetypes' => array(
1223             'editingteacher' => CAP_ALLOW,
1224             'manager' => CAP_ALLOW
1225         )
1226     ),
1228     //new in moodle 1.9
1229     'moodle/question:add' => array(
1230         'riskbitmask' => RISK_SPAM | RISK_XSS,
1231         'captype' => 'write',
1232         'contextlevel' => CONTEXT_COURSE,
1233         'archetypes' => array(
1234             'editingteacher' => CAP_ALLOW,
1235             'manager' => CAP_ALLOW
1236         ),
1237         'clonepermissionsfrom' =>  'moodle/question:manage'
1238     ),
1239     'moodle/question:editmine' => array(
1240         'riskbitmask' => RISK_SPAM | RISK_XSS,
1241         'captype' => 'write',
1242         'contextlevel' => CONTEXT_COURSE,
1243         'archetypes' => array(
1244             'editingteacher' => CAP_ALLOW,
1245             'manager' => CAP_ALLOW
1246         ),
1247         'clonepermissionsfrom' =>  'moodle/question:manage'
1248     ),
1249     'moodle/question:editall' => array(
1250         'riskbitmask' => RISK_SPAM | RISK_XSS,
1251         'captype' => 'write',
1252         'contextlevel' => CONTEXT_COURSE,
1253         'archetypes' => array(
1254             'editingteacher' => CAP_ALLOW,
1255             'manager' => CAP_ALLOW
1256         ),
1257         'clonepermissionsfrom' =>  'moodle/question:manage'
1258     ),
1259     'moodle/question:viewmine' => array(
1260         'captype' => 'read',
1261         'contextlevel' => CONTEXT_COURSE,
1262         'archetypes' => array(
1263             'editingteacher' => CAP_ALLOW,
1264             'manager' => CAP_ALLOW
1265         ),
1266         'clonepermissionsfrom' =>  'moodle/question:manage'
1267     ),
1268     'moodle/question:viewall' => array(
1269         'captype' => 'read',
1270         'contextlevel' => CONTEXT_COURSE,
1271         'archetypes' => array(
1272             'editingteacher' => CAP_ALLOW,
1273             'manager' => CAP_ALLOW
1274         ),
1275         'clonepermissionsfrom' =>  'moodle/question:manage'
1276     ),
1277     'moodle/question:usemine' => array(
1278         'captype' => 'read',
1279         'contextlevel' => CONTEXT_COURSE,
1280         'archetypes' => array(
1281             'editingteacher' => CAP_ALLOW,
1282             'manager' => CAP_ALLOW
1283         ),
1284         'clonepermissionsfrom' =>  'moodle/question:manage'
1285     ),
1286     'moodle/question:useall' => array(
1287         'captype' => 'read',
1288         'contextlevel' => CONTEXT_COURSE,
1289         'archetypes' => array(
1290             'editingteacher' => CAP_ALLOW,
1291             'manager' => CAP_ALLOW
1292         ),
1293         'clonepermissionsfrom' =>  'moodle/question:manage'
1294     ),
1295     'moodle/question:movemine' => array(
1296         'captype' => 'write',
1297         'contextlevel' => CONTEXT_COURSE,
1298         'archetypes' => array(
1299             'editingteacher' => CAP_ALLOW,
1300             'manager' => CAP_ALLOW
1301         ),
1302         'clonepermissionsfrom' =>  'moodle/question:manage'
1303     ),
1304     'moodle/question:moveall' => array(
1305         'captype' => 'write',
1306         'contextlevel' => CONTEXT_COURSE,
1307         'archetypes' => array(
1308             'editingteacher' => CAP_ALLOW,
1309             'manager' => CAP_ALLOW
1310         ),
1311         'clonepermissionsfrom' =>  'moodle/question:manage'
1312     ),
1313     //END new in moodle 1.9
1315     // Configure the installed question types.
1316     'moodle/question:config' => array(
1317         'riskbitmask' => RISK_CONFIG,
1318         'captype' => 'write',
1319         'contextlevel' => CONTEXT_SYSTEM,
1320         'archetypes' => array(
1321             'manager' => CAP_ALLOW
1322         )
1323     ),
1325     // While attempting questions, the ability to flag particular questions for later reference.
1326     'moodle/question:flag' => array(
1327         'captype' => 'write',
1328         'contextlevel' => CONTEXT_COURSE,
1329         'archetypes' => array(
1330             'student' => CAP_ALLOW,
1331             'teacher' => CAP_ALLOW,
1332             'editingteacher' => CAP_ALLOW,
1333             'coursecreator' => CAP_ALLOW,
1334             'manager' => CAP_ALLOW
1335         )
1336     ),
1338     'moodle/site:doclinks' => array(
1339         'captype' => 'read',
1340         'contextlevel' => CONTEXT_SYSTEM,
1341         'archetypes' => array(
1342             'teacher' => CAP_ALLOW,
1343             'editingteacher' => CAP_ALLOW,
1344             'manager' => CAP_ALLOW
1345         )
1346     ),
1348     'moodle/course:sectionvisibility' => array(
1350         'captype' => 'write',
1351         'contextlevel' => CONTEXT_COURSE,
1352         'archetypes' => array(
1353             'editingteacher' => CAP_ALLOW,
1354             'manager' => CAP_ALLOW
1355         )
1356     ),
1358     'moodle/course:useremail' => array(
1360         'captype' => 'write',
1361         'contextlevel' => CONTEXT_COURSE,
1362         'archetypes' => array(
1363             'editingteacher' => CAP_ALLOW,
1364             'manager' => CAP_ALLOW
1365         )
1366     ),
1368     'moodle/course:viewhiddensections' => array(
1370         'captype' => 'write',
1371         'contextlevel' => CONTEXT_COURSE,
1372         'archetypes' => array(
1373             'editingteacher' => CAP_ALLOW,
1374             'manager' => CAP_ALLOW
1375         )
1376     ),
1378     'moodle/course:setcurrentsection' => array(
1380         'captype' => 'write',
1381         'contextlevel' => CONTEXT_COURSE,
1382         'archetypes' => array(
1383             'editingteacher' => CAP_ALLOW,
1384             'manager' => CAP_ALLOW
1385         )
1386     ),
1388     'moodle/site:mnetlogintoremote' => array(
1390         'captype' => 'read',
1391         'contextlevel' => CONTEXT_SYSTEM,
1392         'archetypes' => array(
1393         )
1394     ),
1396     'moodle/grade:viewall' => array(
1397         'riskbitmask' => RISK_PERSONAL,
1398         'captype' => 'read',
1399         'contextlevel' => CONTEXT_COURSE, // and CONTEXT_USER
1400         'archetypes' => array(
1401             'teacher' => CAP_ALLOW,
1402             'editingteacher' => CAP_ALLOW,
1403             'manager' => CAP_ALLOW
1404         ),
1405         'clonepermissionsfrom' => 'moodle/course:viewcoursegrades'
1406     ),
1408     'moodle/grade:view' => array(
1409         'captype' => 'read',
1410         'contextlevel' => CONTEXT_COURSE,
1411         'archetypes' => array(
1412             'student' => CAP_ALLOW
1413         )
1414     ),
1416     'moodle/grade:viewhidden' => array(
1417         'riskbitmask' => RISK_PERSONAL,
1418         'captype' => 'read',
1419         'contextlevel' => CONTEXT_COURSE,
1420         'archetypes' => array(
1421             'teacher' => CAP_ALLOW,
1422             'editingteacher' => CAP_ALLOW,
1423             'manager' => CAP_ALLOW
1424         ),
1425         'clonepermissionsfrom' => 'moodle/course:viewcoursegrades'
1426     ),
1428     'moodle/grade:import' => array(
1429         'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1430         'captype' => 'write',
1431         'contextlevel' => CONTEXT_COURSE,
1432         'archetypes' => array(
1433             'editingteacher' => CAP_ALLOW,
1434             'manager' => CAP_ALLOW
1435         ),
1436         'clonepermissionsfrom' => 'moodle/course:managegrades'
1437     ),
1439     'moodle/grade:export' => array(
1440         'riskbitmask' => RISK_PERSONAL,
1441         'captype' => 'read',
1442         'contextlevel' => CONTEXT_COURSE,
1443         'archetypes' => array(
1444             'teacher' => CAP_ALLOW,
1445             'editingteacher' => CAP_ALLOW,
1446             'manager' => CAP_ALLOW
1447         ),
1448         'clonepermissionsfrom' => 'moodle/course:managegrades'
1449     ),
1451     'moodle/grade:manage' => array(
1452         'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1453         'captype' => 'write',
1454         'contextlevel' => CONTEXT_COURSE,
1455         'archetypes' => array(
1456             'editingteacher' => CAP_ALLOW,
1457             'manager' => CAP_ALLOW
1458         ),
1459         'clonepermissionsfrom' => 'moodle/course:managegrades'
1460     ),
1462     'moodle/grade:edit' => array(
1463         'riskbitmask' => RISK_PERSONAL | RISK_XSS,
1464         'captype' => 'write',
1465         'contextlevel' => CONTEXT_COURSE,
1466         'archetypes' => array(
1467             'editingteacher' => CAP_ALLOW,
1468             'manager' => CAP_ALLOW
1469         ),
1470         'clonepermissionsfrom' => 'moodle/course:managegrades'
1471     ),
1473     'moodle/grade:manageoutcomes' => array(
1474         'captype' => 'write',
1475         'contextlevel' => CONTEXT_COURSE,
1476         'archetypes' => array(
1477             'editingteacher' => CAP_ALLOW,
1478             'manager' => CAP_ALLOW
1479         ),
1480         'clonepermissionsfrom' => 'moodle/course:managegrades'
1481     ),
1483     'moodle/grade:manageletters' => array(
1484         'captype' => 'write',
1485         'contextlevel' => CONTEXT_COURSE,
1486         'archetypes' => array(
1487             'editingteacher' => CAP_ALLOW,
1488             'manager' => CAP_ALLOW
1489         ),
1490         'clonepermissionsfrom' => 'moodle/course:managegrades'
1491     ),
1493     'moodle/grade:hide' => array(
1494         'captype' => 'write',
1495         'contextlevel' => CONTEXT_COURSE,
1496         'archetypes' => array(
1497             'editingteacher' => CAP_ALLOW,
1498             'manager' => CAP_ALLOW
1499         )
1500     ),
1502     'moodle/grade:lock' => array(
1503         'captype' => 'write',
1504         'contextlevel' => CONTEXT_COURSE,
1505         'archetypes' => array(
1506             'editingteacher' => CAP_ALLOW,
1507             'manager' => CAP_ALLOW
1508         )
1509     ),
1511     'moodle/grade:unlock' => array(
1512         'captype' => 'write',
1513         'contextlevel' => CONTEXT_COURSE,
1514         'archetypes' => array(
1515             'editingteacher' => CAP_ALLOW,
1516             'manager' => CAP_ALLOW
1517         )
1518     ),
1520     'moodle/my:manageblocks' => array(
1521         'captype' => 'write',
1522         'contextlevel' => CONTEXT_SYSTEM,
1523         'archetypes' => array(
1524             'user' => CAP_ALLOW
1525         )
1526     ),
1528     'moodle/notes:view' => array(
1529         'captype' => 'read',
1530         'contextlevel' => CONTEXT_COURSE,
1531         'archetypes' => array(
1532             'teacher' => CAP_ALLOW,
1533             'editingteacher' => CAP_ALLOW,
1534             'manager' => CAP_ALLOW
1535         )
1536     ),
1538     'moodle/notes:manage' => array(
1539         'riskbitmask' => RISK_SPAM,
1541         'captype' => 'write',
1542         'contextlevel' => CONTEXT_COURSE,
1543         'archetypes' => array(
1544             'teacher' => CAP_ALLOW,
1545             'editingteacher' => CAP_ALLOW,
1546             'manager' => CAP_ALLOW
1547         )
1548     ),
1550     'moodle/tag:manage' => array(
1551         'riskbitmask' => RISK_SPAM,
1553         'captype' => 'write',
1554         'contextlevel' => CONTEXT_SYSTEM,
1555         'archetypes' => array(
1556             'teacher' => CAP_ALLOW,
1557             'editingteacher' => CAP_ALLOW,
1558             'manager' => CAP_ALLOW
1559         )
1560     ),
1562     'moodle/tag:create' => array(
1563         'riskbitmask' => RISK_SPAM,
1565         'captype' => 'write',
1566         'contextlevel' => CONTEXT_SYSTEM,
1567         'archetypes' => array(
1568             'manager' => CAP_ALLOW,
1569             'user' => CAP_ALLOW
1570         )
1571     ),
1573     'moodle/tag:edit' => array(
1574         'riskbitmask' => RISK_SPAM,
1576         'captype' => 'write',
1577         'contextlevel' => CONTEXT_SYSTEM,
1578         'archetypes' => array(
1579             'manager' => CAP_ALLOW,
1580             'user' => CAP_ALLOW
1581         )
1582     ),
1584     'moodle/tag:editblocks' => array(
1585         'captype' => 'write',
1586         'contextlevel' => CONTEXT_SYSTEM,
1587         'archetypes' => array(
1588             'teacher' => CAP_ALLOW,
1589             'editingteacher' => CAP_ALLOW,
1590             'manager' => CAP_ALLOW
1591         )
1592     ),
1594     'moodle/block:view' => array(
1595         'captype' => 'read',
1596         'contextlevel' => CONTEXT_BLOCK,
1597         'archetypes' => array(
1598             'guest' => CAP_ALLOW,
1599             'user' => CAP_ALLOW,
1600             'student' => CAP_ALLOW,
1601             'teacher' => CAP_ALLOW,
1602             'editingteacher' => CAP_ALLOW,
1603             'coursecreator' => CAP_ALLOW
1604         )
1605     ),
1607     'moodle/block:edit' => array(
1608         'riskbitmask' => RISK_SPAM | RISK_XSS,
1610         'captype' => 'write',
1611         'contextlevel' => CONTEXT_BLOCK,
1612         'archetypes' => array(
1613             'editingteacher' => CAP_ALLOW,
1614             'coursecreator' => CAP_ALLOW
1615         )
1616     ),
1618     'moodle/portfolio:export' => array(
1619         'captype' => 'read',
1620         'contextlevel' => CONTEXT_SYSTEM,
1621         'archetypes' => array(
1622             'user' => CAP_ALLOW,
1623             'student' => CAP_ALLOW,
1624             'teacher' => CAP_ALLOW,
1625             'editingteacher' => CAP_ALLOW,
1626             'coursecreator' => CAP_ALLOW
1627         )
1628     ),
1629     'moodle/comment:view' => array(
1631         'captype' => 'read',
1632         'contextlevel' => CONTEXT_COURSE,
1633         'archetypes' => array(
1634             'user' => CAP_ALLOW,
1635             'student' => CAP_ALLOW,
1636             'teacher' => CAP_ALLOW,
1637             'editingteacher' => CAP_ALLOW,
1638             'coursecreator' => CAP_ALLOW,
1639             'manager' => CAP_ALLOW
1640         )
1641     ),
1642     'moodle/comment:post' => array(
1644         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1645         'captype' => 'write',
1646         'contextlevel' => CONTEXT_COURSE,
1647         'archetypes' => array(
1648             'user' => CAP_ALLOW,
1649             'student' => CAP_ALLOW,
1650             'teacher' => CAP_ALLOW,
1651             'editingteacher' => CAP_ALLOW,
1652             'coursecreator' => CAP_ALLOW,
1653             'manager' => CAP_ALLOW
1654         )
1655     ),
1656     'moodle/comment:delete' => array(
1658         'riskbitmask' => RISK_DATALOSS,
1659         'captype' => 'write',
1660         'contextlevel' => CONTEXT_COURSE,
1661         'archetypes' => array(
1662             'editingteacher' => CAP_ALLOW,
1663             'coursecreator' => CAP_ALLOW,
1664             'manager' => CAP_ALLOW
1665         )
1666     ),
1667     'moodle/webservice:createtoken' => array(
1669         'riskbitmask' => RISK_CONFIG | RISK_DATALOSS | RISK_SPAM | RISK_PERSONAL | RISK_XSS,
1670         'captype' => 'write',
1671         'contextlevel' => CONTEXT_SYSTEM,
1672         'archetypes' => array(
1673             'manager' => CAP_ALLOW
1674         )
1675     ),
1676     'moodle/rating:view' => array(
1678         'captype' => 'read',
1679         'contextlevel' => CONTEXT_COURSE,
1680         'archetypes' => array(
1681             'user' => CAP_ALLOW,
1682             'student' => CAP_ALLOW,
1683             'teacher' => CAP_ALLOW,
1684             'editingteacher' => CAP_ALLOW,
1685             'manager' => CAP_ALLOW
1686         )
1687     ),
1688     'moodle/rating:viewany' => array(
1690         'riskbitmask' => RISK_PERSONAL,
1691         'captype' => 'read',
1692         'contextlevel' => CONTEXT_COURSE,
1693         'archetypes' => array(
1694             'user' => CAP_ALLOW,
1695             'student' => CAP_ALLOW,
1696             'teacher' => CAP_ALLOW,
1697             'editingteacher' => CAP_ALLOW,
1698             'manager' => CAP_ALLOW
1699         )
1700     ),
1701     'moodle/rating:viewall' => array(
1703         'riskbitmask' => RISK_PERSONAL,
1704         'captype' => 'read',
1705         'contextlevel' => CONTEXT_COURSE,
1706         'archetypes' => array(
1707             'user' => CAP_ALLOW,
1708             'student' => CAP_ALLOW,
1709             'teacher' => CAP_ALLOW,
1710             'editingteacher' => CAP_ALLOW,
1711             'manager' => CAP_ALLOW
1712         )
1713     ),
1714     'moodle/rating:rate' => array(
1716         'captype' => 'write',
1717         'contextlevel' => CONTEXT_COURSE,
1718         'archetypes' => array(
1719             'user' => CAP_ALLOW,
1720             'student' => CAP_ALLOW,
1721             'teacher' => CAP_ALLOW,
1722             'editingteacher' => CAP_ALLOW,
1723             'manager' => CAP_ALLOW
1724         )
1725     ),
1726      'moodle/course:publish' => array(
1728         'captype' => 'write',
1729         'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
1730         'contextlevel' => CONTEXT_SYSTEM,
1731         'archetypes' => array(
1732             'manager' => CAP_ALLOW
1733         )
1734     ),
1735     'moodle/course:markcomplete' => array(
1736         'captype' => 'write',
1737         'contextlevel' => CONTEXT_COURSE,
1738         'archetypes' => array(
1739             'teacher' => CAP_ALLOW,
1740             'editingteacher' => CAP_ALLOW,
1741             'coursecreator' => CAP_ALLOW,
1742             'manager' => CAP_ALLOW
1743         )
1744     ),
1745     'moodle/community:add' => array(
1746         'captype' => 'write',
1747         'contextlevel' => CONTEXT_SYSTEM,
1748         'archetypes' => array(
1749             'manager' => CAP_ALLOW,
1750             'teacher' => CAP_ALLOW,
1751             'editingteacher' => CAP_ALLOW,
1752             'coursecreator' => CAP_ALLOW
1753         )
1754     ),
1755     'moodle/community:download' => array(
1756         'captype' => 'write',
1757         'contextlevel' => CONTEXT_SYSTEM,
1758         'archetypes' => array(
1759             'manager' => CAP_ALLOW,
1760             'editingteacher' => CAP_ALLOW,
1761             'coursecreator' => CAP_ALLOW
1762         )
1763     )
1764 );