MDL-9660 - Fixed groups matches functions and added unit tests for them..
[moodle.git] / lib / db / access.php
CommitLineData
bbbf2d40 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]/<component_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 follows the format
29// $<componenttype>_<component_name>_capabilities
30//
31// For the core capabilities, the variable is $moodle_capabilities.
32
33
34$moodle_capabilities = array(
eef868d1 35
bbbf2d40 36 'moodle/site:doanything' => array(
bcdb0f19 37
a6b02b65 38 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
bcdb0f19 39
bbbf2d40 40 'captype' => 'admin',
41 'contextlevel' => CONTEXT_SYSTEM
42 ),
eef868d1 43
bbbf2d40 44 'moodle/legacy:guest' => array(
bcdb0f19 45
bbbf2d40 46 'captype' => 'legacy',
47 'contextlevel' => CONTEXT_SYSTEM
48 ),
eef868d1 49
c785d40a 50 'moodle/legacy:user' => array(
51
52 'captype' => 'legacy',
53 'contextlevel' => CONTEXT_SYSTEM
54 ),
eef868d1 55
bbbf2d40 56 'moodle/legacy:student' => array(
bcdb0f19 57
21b6db6e 58 'riskbitmask' => RISK_SPAM,
bcdb0f19 59
bbbf2d40 60 'captype' => 'legacy',
61 'contextlevel' => CONTEXT_SYSTEM
62 ),
eef868d1 63
64
bbbf2d40 65 'moodle/legacy:teacher' => array(
bcdb0f19 66
21b6db6e 67 'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
bcdb0f19 68
bbbf2d40 69 'captype' => 'legacy',
70 'contextlevel' => CONTEXT_SYSTEM
71 ),
eef868d1 72
73
bbbf2d40 74 'moodle/legacy:editingteacher' => array(
bcdb0f19 75
21b6db6e 76 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
bcdb0f19 77
bbbf2d40 78 'captype' => 'legacy',
79 'contextlevel' => CONTEXT_SYSTEM
80 ),
eef868d1 81
82
bbbf2d40 83 'moodle/legacy:coursecreator' => array(
bcdb0f19 84
21b6db6e 85 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
bcdb0f19 86
bbbf2d40 87 'captype' => 'legacy',
88 'contextlevel' => CONTEXT_SYSTEM
89 ),
eef868d1 90
91
bbbf2d40 92 'moodle/legacy:admin' => array(
bcdb0f19 93
a6b02b65 94 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
bcdb0f19 95
bbbf2d40 96 'captype' => 'legacy',
97 'contextlevel' => CONTEXT_SYSTEM
98 ),
eef868d1 99
100
bbbf2d40 101 'moodle/site:config' => array(
eef868d1 102
a6b02b65 103 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
21b6db6e 104
bbbf2d40 105 'captype' => 'write',
106 'contextlevel' => CONTEXT_SYSTEM,
107 'legacy' => array(
bbbf2d40 108 'admin' => CAP_ALLOW
109 )
110 ),
eef868d1 111
51792df0 112 'moodle/site:readallmessages' => array(
eef868d1 113
bcdb0f19 114 'riskbitmask' => RISK_PERSONAL,
115
51792df0 116 'captype' => 'read',
117 'contextlevel' => CONTEXT_SYSTEM,
118 'legacy' => array(
4b7ae3c4 119 'admin' => CAP_ALLOW,
120 'editingteacher' => CAP_ALLOW
51792df0 121 )
122 ),
eef868d1 123
51792df0 124 'moodle/site:approvecourse' => array(
eef868d1 125
bcdb0f19 126 'riskbitmask' => RISK_XSS,
127
51792df0 128 'captype' => 'write',
129 'contextlevel' => CONTEXT_SYSTEM,
130 'legacy' => array(
51792df0 131 'admin' => CAP_ALLOW
132 )
133 ),
eef868d1 134
bbbf2d40 135 'moodle/site:import' => array(
eef868d1 136
21b6db6e 137 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
138
bbbf2d40 139 'captype' => 'write',
140 'contextlevel' => CONTEXT_SYSTEM,
141 'legacy' => array(
a028c291 142 'editingteacher' => CAP_ALLOW,
bbbf2d40 143 'admin' => CAP_ALLOW
144 )
145 ),
eef868d1 146
bbbf2d40 147 'moodle/site:backup' => array(
eef868d1 148
21b6db6e 149 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
150
bbbf2d40 151 'captype' => 'write',
152 'contextlevel' => CONTEXT_SYSTEM,
153 'legacy' => array(
7246585a 154 'editingteacher' => CAP_ALLOW,
bbbf2d40 155 'admin' => CAP_ALLOW
156 )
157 ),
eef868d1 158
bbbf2d40 159 'moodle/site:restore' => array(
eef868d1 160
21b6db6e 161 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
162
bbbf2d40 163 'captype' => 'write',
164 'contextlevel' => CONTEXT_SYSTEM,
165 'legacy' => array(
7246585a 166 'editingteacher' => CAP_ALLOW,
bbbf2d40 167 'admin' => CAP_ALLOW
168 )
169 ),
eef868d1 170
bbbf2d40 171 'moodle/site:manageblocks' => array(
eef868d1 172
21b6db6e 173 'riskbitmask' => RISK_SPAM | RISK_XSS,
174
bbbf2d40 175 'captype' => 'write',
176 'contextlevel' => CONTEXT_SYSTEM,
177 'legacy' => array(
73b73d21 178 'editingteacher' => CAP_ALLOW,
bbbf2d40 179 'admin' => CAP_ALLOW
180 )
181 ),
eef868d1 182
27950688 183 'moodle/site:accessallgroups' => array(
eef868d1 184
27950688 185 'captype' => 'read',
186 'contextlevel' => CONTEXT_SYSTEM,
187 'legacy' => array(
27950688 188 'teacher' => CAP_ALLOW,
189 'editingteacher' => CAP_ALLOW,
27950688 190 'admin' => CAP_ALLOW
191 )
192 ),
eef868d1 193
53d7785b 194 'moodle/site:viewfullnames' => array(
eef868d1 195
53d7785b 196 'captype' => 'read',
197 'contextlevel' => CONTEXT_SYSTEM,
198 'legacy' => array(
53d7785b 199 'teacher' => CAP_ALLOW,
200 'editingteacher' => CAP_ALLOW,
53d7785b 201 'admin' => CAP_ALLOW
202 )
203 ),
eef868d1 204
a028c291 205 'moodle/site:viewreports' => array(
eef868d1 206
21b6db6e 207 'riskbitmask' => RISK_PERSONAL,
208
a028c291 209 'captype' => 'read',
77d4953e 210 'contextlevel' => CONTEXT_SYSTEM,
a028c291 211 'legacy' => array(
a028c291 212 'teacher' => CAP_ALLOW,
213 'editingteacher' => CAP_ALLOW,
a028c291 214 'admin' => CAP_ALLOW
215 )
216 ),
eef868d1 217
7d8a3cb0 218 'moodle/site:trustcontent' => array(
eef868d1 219
21b6db6e 220 'riskbitmask' => RISK_XSS,
221
7d8a3cb0 222 'captype' => 'write',
223 'contextlevel' => CONTEXT_SYSTEM,
224 'legacy' => array(
7d8a3cb0 225 'editingteacher' => CAP_ALLOW,
7d8a3cb0 226 'admin' => CAP_ALLOW
227 )
228 ),
eef868d1 229
6df3c7df 230 'moodle/site:uploadusers' => array(
eef868d1 231
21b6db6e 232 'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
233
bbbf2d40 234 'captype' => 'write',
235 'contextlevel' => CONTEXT_SYSTEM,
236 'legacy' => array(
bbbf2d40 237 'admin' => CAP_ALLOW
238 )
239 ),
eef868d1 240
6df3c7df 241
242 'moodle/user:create' => array(
243
244 'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
eef868d1 245
bbbf2d40 246 'captype' => 'write',
247 'contextlevel' => CONTEXT_SYSTEM,
248 'legacy' => array(
bbbf2d40 249 'admin' => CAP_ALLOW
250 )
251 ),
eef868d1 252
6df3c7df 253 'moodle/user:delete' => array(
cc891abe 254
bcdb0f19 255 'riskbitmask' => RISK_PERSONAL,
256
cc891abe 257 'captype' => 'write',
258 'contextlevel' => CONTEXT_SYSTEM,
259 'legacy' => array(
cc891abe 260 'admin' => CAP_ALLOW
261 )
262 ),
263
6df3c7df 264 'moodle/user:update' => array(
cc891abe 265
266 'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
21b6db6e 267
bbbf2d40 268 'captype' => 'write',
269 'contextlevel' => CONTEXT_SYSTEM,
270 'legacy' => array(
bbbf2d40 271 'admin' => CAP_ALLOW
272 )
273 ),
eef868d1 274
bbbf2d40 275 'moodle/user:viewdetails' => array(
eef868d1 276
e58eca72 277 'captype' => 'read',
bbbf2d40 278 'contextlevel' => CONTEXT_SYSTEM,
279 'legacy' => array(
22ae509e 280 'guest' => CAP_ALLOW,
281 'student' => CAP_ALLOW,
282 'teacher' => CAP_ALLOW,
283 'editingteacher' => CAP_ALLOW,
bbbf2d40 284 'admin' => CAP_ALLOW
285 )
286 ),
e58eca72 287
288 'moodle/user:viewhiddendetails' => array(
eef868d1 289
21b6db6e 290 'riskbitmask' => RISK_PERSONAL,
291
e58eca72 292 'captype' => 'read',
293 'contextlevel' => CONTEXT_SYSTEM,
294 'legacy' => array(
e58eca72 295 'teacher' => CAP_ALLOW,
296 'editingteacher' => CAP_ALLOW,
e58eca72 297 'admin' => CAP_ALLOW
298 )
299 ),
eef868d1 300
6c95827f 301 'moodle/user:viewusergrades' => array(
bcdb0f19 302
6c95827f 303 'captype' => 'write',
304 'contextlevel' => CONTEXT_COURSE,
305 'legacy' => array(
6c95827f 306 'student' => CAP_ALLOW,
307 'teacher' => CAP_ALLOW,
308 'editingteacher' => CAP_ALLOW,
6c95827f 309 'admin' => CAP_ALLOW
310 )
311 ),
bcdb0f19 312
6c95827f 313 'moodle/user:loginas' => array(
314
315 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
316
317 'captype' => 'write',
318 'contextlevel' => CONTEXT_COURSE,
319 'legacy' => array(
6c95827f 320 'admin' => CAP_ALLOW
321 )
322 ),
323
bbbf2d40 324 'moodle/role:assign' => array(
eef868d1 325
bbbf2d40 326 'captype' => 'write',
327 'contextlevel' => CONTEXT_SYSTEM,
328 'legacy' => array(
861fdcaa 329 'editingteacher' => CAP_ALLOW,
68c52526 330 'admin' => CAP_ALLOW
331 )
332 ),
eef868d1 333
68c52526 334 'moodle/role:override' => array(
eef868d1 335
bcdb0f19 336 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
337
68c52526 338 'captype' => 'write',
339 'contextlevel' => CONTEXT_SYSTEM,
340 'legacy' => array(
bbbf2d40 341 'admin' => CAP_ALLOW
342 )
343 ),
eef868d1 344
bbbf2d40 345 'moodle/role:manage' => array(
eef868d1 346
bcdb0f19 347 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
348
bbbf2d40 349 'captype' => 'write',
350 'contextlevel' => CONTEXT_SYSTEM,
351 'legacy' => array(
bbbf2d40 352 'admin' => CAP_ALLOW
353 )
354 ),
f43ce1ad 355
356 'moodle/role:unassignself' => array(
bcdb0f19 357
f43ce1ad 358 'captype' => 'write',
359 'contextlevel' => CONTEXT_SYSTEM,
360 'legacy' => array(
2d5a4f25 361 'student' => (empty($CFG->allowunenrol)) ? CAP_INHERIT : CAP_ALLOW,
f43ce1ad 362 'teacher' => CAP_ALLOW,
363 'editingteacher' => CAP_ALLOW,
364 'coursecreator' => CAP_ALLOW,
365 'admin' => CAP_ALLOW
366 )
367 ),
99f9cb51 368
369 'moodle/role:viewhiddenassigns' => array(
bcdb0f19 370
99f9cb51 371 'captype' => 'read',
372 'contextlevel' => CONTEXT_SYSTEM,
373 'legacy' => array(
99f9cb51 374 'teacher' => CAP_ALLOW,
375 'editingteacher' => CAP_ALLOW,
99f9cb51 376 'admin' => CAP_ALLOW
377 )
378 ),
eef868d1 379
20dd4cf5 380 'moodle/role:switchroles' => array(
bcdb0f19 381
20dd4cf5 382 'riskbitmask' => RISK_XSS,
bcdb0f19 383
20dd4cf5 384 'captype' => 'read',
385 'contextlevel' => CONTEXT_SYSTEM,
386 'legacy' => array(
20dd4cf5 387 'editingteacher' => CAP_ALLOW,
20dd4cf5 388 'admin' => CAP_ALLOW
389 )
390 ),
391
bbbf2d40 392 'moodle/category:create' => array(
eef868d1 393
bbbf2d40 394 'captype' => 'write',
395 'contextlevel' => CONTEXT_COURSECAT,
396 'legacy' => array(
bbbf2d40 397 'admin' => CAP_ALLOW
398 )
399 ),
eef868d1 400
bbbf2d40 401 'moodle/category:delete' => array(
eef868d1 402
bbbf2d40 403 'captype' => 'write',
404 'contextlevel' => CONTEXT_COURSECAT,
405 'legacy' => array(
bbbf2d40 406 'admin' => CAP_ALLOW
407 )
408 ),
eef868d1 409
bbbf2d40 410 'moodle/category:update' => array(
eef868d1 411
bbbf2d40 412 'captype' => 'write',
413 'contextlevel' => CONTEXT_COURSECAT,
414 'legacy' => array(
bbbf2d40 415 'admin' => CAP_ALLOW
416 )
417 ),
eef868d1 418
bbbf2d40 419 'moodle/category:visibility' => array(
eef868d1 420
bbbf2d40 421 'captype' => 'write',
422 'contextlevel' => CONTEXT_COURSECAT,
423 'legacy' => array(
bbbf2d40 424 'admin' => CAP_ALLOW
425 )
426 ),
eef868d1 427
bbbf2d40 428 'moodle/course:create' => array(
eef868d1 429
21b6db6e 430 'riskbitmask' => RISK_XSS,
431
bbbf2d40 432 'captype' => 'write',
5e992f56 433 'contextlevel' => CONTEXT_COURSECAT,
bbbf2d40 434 'legacy' => array(
4473252d 435 'coursecreator' => CAP_ALLOW,
bbbf2d40 436 'admin' => CAP_ALLOW
437 )
438 ),
eef868d1 439
bbbf2d40 440 'moodle/course:delete' => array(
eef868d1 441
bbbf2d40 442 'captype' => 'write',
443 'contextlevel' => CONTEXT_COURSE,
444 'legacy' => array(
bbbf2d40 445 'admin' => CAP_ALLOW
446 )
447 ),
eef868d1 448
bbbf2d40 449 'moodle/course:update' => array(
eef868d1 450
21b6db6e 451 'riskbitmask' => RISK_XSS,
452
bbbf2d40 453 'captype' => 'write',
454 'contextlevel' => CONTEXT_COURSE,
455 'legacy' => array(
bbbf2d40 456 'editingteacher' => CAP_ALLOW,
bbbf2d40 457 'admin' => CAP_ALLOW
458 )
459 ),
eef868d1 460
bbbf2d40 461 'moodle/course:view' => array(
eef868d1 462
bbbf2d40 463 'captype' => 'read',
464 'contextlevel' => CONTEXT_COURSE,
465 'legacy' => array(
b0f55230 466 'guest' => CAP_ALLOW,
bbbf2d40 467 'student' => CAP_ALLOW,
468 'teacher' => CAP_ALLOW,
72cf2e39 469 'editingteacher' => CAP_ALLOW
bbbf2d40 470 )
471 ),
eef868d1 472
77c645df 473 'moodle/course:bulkmessaging' => array(
474
475 'riskbitmask' => RISK_SPAM,
476
477 'captype' => 'write',
478 'contextlevel' => CONTEXT_COURSE,
479 'legacy' => array(
77c645df 480 'teacher' => CAP_ALLOW,
481 'editingteacher' => CAP_ALLOW,
77c645df 482 'admin' => CAP_ALLOW
483 )
484 ),
485
1c45e42e 486 'moodle/course:viewhiddenuserfields' => array(
eef868d1 487
21b6db6e 488 'riskbitmask' => RISK_PERSONAL,
489
1c45e42e 490 'captype' => 'read',
491 'contextlevel' => CONTEXT_COURSE,
492 'legacy' => array(
1c45e42e 493 'teacher' => CAP_ALLOW,
494 'editingteacher' => CAP_ALLOW,
1c45e42e 495 'admin' => CAP_ALLOW
496 )
497 ),
eef868d1 498
1c45e42e 499 'moodle/course:viewhiddencourses' => array(
eef868d1 500
1c45e42e 501 'captype' => 'read',
502 'contextlevel' => CONTEXT_COURSE,
503 'legacy' => array(
2f5ab42b 504 'coursecreator' => CAP_ALLOW,
505 'teacher' => CAP_ALLOW,
506 'editingteacher' => CAP_ALLOW,
507 'admin' => CAP_ALLOW
1c45e42e 508 )
509 ),
eef868d1 510
bbbf2d40 511 'moodle/course:visibility' => array(
eef868d1 512
bbbf2d40 513 'captype' => 'write',
514 'contextlevel' => CONTEXT_COURSE,
515 'legacy' => array(
bbbf2d40 516 'admin' => CAP_ALLOW
517 )
518 ),
eef868d1 519
a028c291 520 'moodle/course:managefiles' => array(
eef868d1 521
21b6db6e 522 'riskbitmask' => RISK_XSS,
523
a028c291 524 'captype' => 'write',
525 'contextlevel' => CONTEXT_COURSE,
526 'legacy' => array(
a028c291 527 'editingteacher' => CAP_ALLOW,
a028c291 528 'admin' => CAP_ALLOW
529 )
530 ),
eef868d1 531
bbbf2d40 532 'moodle/course:manageactivities' => array(
eef868d1 533
21b6db6e 534 'riskbitmask' => RISK_XSS,
535
bbbf2d40 536 'captype' => 'write',
537 'contextlevel' => CONTEXT_COURSE,
538 'legacy' => array(
bbbf2d40 539 'editingteacher' => CAP_ALLOW,
bbbf2d40 540 'admin' => CAP_ALLOW
541 )
542 ),
eef868d1 543
b79da3ac 544 'moodle/course:managemetacourse' => array(
eef868d1 545
4b7aaf40 546 'captype' => 'write',
547 'contextlevel' => CONTEXT_COURSE,
548 'legacy' => array(
4b7aaf40 549 'editingteacher' => CAP_ALLOW,
4b7aaf40 550 'admin' => CAP_ALLOW
551 )
552 ),
eef868d1 553
bbbf2d40 554 'moodle/course:activityvisibility' => array(
eef868d1 555
bbbf2d40 556 'captype' => 'write',
557 'contextlevel' => CONTEXT_COURSE,
558 'legacy' => array(
bbbf2d40 559 'editingteacher' => CAP_ALLOW,
bbbf2d40 560 'admin' => CAP_ALLOW
561 )
562 ),
eef868d1 563
bbbf2d40 564 'moodle/course:viewhiddenactivities' => array(
eef868d1 565
bbbf2d40 566 'captype' => 'write',
567 'contextlevel' => CONTEXT_COURSE,
568 'legacy' => array(
bbbf2d40 569 'teacher' => CAP_ALLOW,
570 'editingteacher' => CAP_ALLOW,
bbbf2d40 571 'admin' => CAP_ALLOW
572 )
573 ),
eef868d1 574
bbbf2d40 575 'moodle/course:viewparticipants' => array(
eef868d1 576
bbbf2d40 577 'captype' => 'read',
578 'contextlevel' => CONTEXT_COURSE,
579 'legacy' => array(
bbbf2d40 580 'student' => CAP_ALLOW,
581 'teacher' => CAP_ALLOW,
582 'editingteacher' => CAP_ALLOW,
bbbf2d40 583 'admin' => CAP_ALLOW
584 )
585 ),
eef868d1 586
bbbf2d40 587 'moodle/course:viewscales' => array(
eef868d1 588
bbbf2d40 589 'captype' => 'read',
590 'contextlevel' => CONTEXT_COURSE,
591 'legacy' => array(
bbbf2d40 592 'student' => CAP_ALLOW,
593 'teacher' => CAP_ALLOW,
594 'editingteacher' => CAP_ALLOW,
bbbf2d40 595 'admin' => CAP_ALLOW
596 )
597 ),
eef868d1 598
bbbf2d40 599 'moodle/course:managescales' => array(
eef868d1 600
bbbf2d40 601 'captype' => 'write',
602 'contextlevel' => CONTEXT_COURSE,
603 'legacy' => array(
bbbf2d40 604 'editingteacher' => CAP_ALLOW,
bbbf2d40 605 'admin' => CAP_ALLOW
606 )
607 ),
eef868d1 608
bbbf2d40 609 'moodle/course:managegroups' => array(
610
611 'captype' => 'write',
612 'contextlevel' => CONTEXT_COURSE,
a028c291 613 'legacy' => array(
a028c291 614 'editingteacher' => CAP_ALLOW,
a028c291 615 'admin' => CAP_ALLOW
616 )
617 ),
eef868d1 618
a028c291 619 'moodle/course:reset' => array(
620
621 'captype' => 'write',
622 'contextlevel' => CONTEXT_COURSE,
bbbf2d40 623 'legacy' => array(
bbbf2d40 624 'editingteacher' => CAP_ALLOW,
bbbf2d40 625 'admin' => CAP_ALLOW
626 )
627 ),
eef868d1 628
bbbf2d40 629 'moodle/blog:view' => array(
630
631 'captype' => 'read',
632 'contextlevel' => CONTEXT_SYSTEM,
633 'legacy' => array(
00adf177 634 'guest' => CAP_ALLOW,
c785d40a 635 'user' => CAP_ALLOW,
bbbf2d40 636 'student' => CAP_ALLOW,
637 'teacher' => CAP_ALLOW,
638 'editingteacher' => CAP_ALLOW,
bbbf2d40 639 'admin' => CAP_ALLOW
640 )
641 ),
eef868d1 642
5a8ab2e9 643 'moodle/blog:create' => array( // works in CONTEXT_SYSTEM only
bbbf2d40 644
21b6db6e 645 'riskbitmask' => RISK_SPAM,
646
bbbf2d40 647 'captype' => 'write',
648 'contextlevel' => CONTEXT_SYSTEM,
649 'legacy' => array(
c785d40a 650 'user' => CAP_ALLOW,
bbbf2d40 651 'admin' => CAP_ALLOW
652 )
653 ),
eef868d1 654
bbbf2d40 655 'moodle/blog:manageofficialtags' => array(
656
21b6db6e 657 'riskbitmask' => RISK_SPAM,
658
bbbf2d40 659 'captype' => 'write',
660 'contextlevel' => CONTEXT_SYSTEM,
661 'legacy' => array(
bbbf2d40 662 'admin' => CAP_ALLOW
663 )
664 ),
eef868d1 665
bbbf2d40 666 'moodle/blog:managepersonaltags' => array(
667
21b6db6e 668 'riskbitmask' => RISK_SPAM,
669
bbbf2d40 670 'captype' => 'write',
671 'contextlevel' => CONTEXT_SYSTEM,
672 'legacy' => array(
bbbf2d40 673 'student' => CAP_ALLOW,
674 'teacher' => CAP_ALLOW,
675 'editingteacher' => CAP_ALLOW,
bbbf2d40 676 'admin' => CAP_ALLOW
677 )
678 ),
eef868d1 679
bbbf2d40 680 'moodle/blog:manageentries' => array(
681
21b6db6e 682 'riskbitmask' => RISK_SPAM,
683
bbbf2d40 684 'captype' => 'write',
685 'contextlevel' => CONTEXT_SYSTEM,
686 'legacy' => array(
bbbf2d40 687 'teacher' => CAP_ALLOW,
688 'editingteacher' => CAP_ALLOW,
bbbf2d40 689 'admin' => CAP_ALLOW
690 )
691 ),
eef868d1 692
5a8ab2e9 693 'moodle/calendar:manageownentries' => array( // works in CONTEXT_SYSTEM only
bbbf2d40 694
21b6db6e 695 'riskbitmask' => RISK_SPAM,
696
bbbf2d40 697 'captype' => 'write',
698 'contextlevel' => CONTEXT_SYSTEM,
699 'legacy' => array(
c785d40a 700 'user' => CAP_ALLOW,
bbbf2d40 701 'admin' => CAP_ALLOW
702 )
703 ),
eef868d1 704
bbbf2d40 705 'moodle/calendar:manageentries' => array(
706
21b6db6e 707 'riskbitmask' => RISK_SPAM,
708
bbbf2d40 709 'captype' => 'write',
710 'contextlevel' => CONTEXT_SYSTEM,
711 'legacy' => array(
bbbf2d40 712 'teacher' => CAP_ALLOW,
713 'editingteacher' => CAP_ALLOW,
bbbf2d40 714 'admin' => CAP_ALLOW
715 )
77d4953e 716 ),
8305aeaa 717
718 'moodle/user:editprofile' => array(
719
720 'riskbitmask' => RISK_SPAM,
721
1cb3da36 722 'captype' => 'write',
8305aeaa 723 'contextlevel' => CONTEXT_USER,
724 'legacy' => array(
725 'admin' => CAP_ALLOW
726 )
727 ),
eef868d1 728
1cb3da36 729 'moodle/user:editownprofile' => array(
730
731 'captype' => 'write',
732 'contextlevel' => CONTEXT_SYSTEM,
733 'legacy' => array(
734 'guest' => CAP_PROHIBIT,
735 'user' => CAP_ALLOW,
736 'admin' => CAP_ALLOW
737 )
738 ),
739
740 'moodle/user:changeownpassword' => array(
741
742 'captype' => 'write',
743 'contextlevel' => CONTEXT_SYSTEM,
744 'legacy' => array(
745 'guest' => CAP_PROHIBIT,
746 'user' => CAP_ALLOW,
747 'admin' => CAP_ALLOW
748 )
749 ),
750
eef868d1 751 // The next 3 might make no sense for some roles, e.g teacher, etc.
77d4953e 752 // since the next level up is site. These are more for the parent role
753 'moodle/user:readuserposts' => array(
bcdb0f19 754
77d4953e 755 'captype' => 'read',
4b10f08b 756 'contextlevel' => CONTEXT_USER,
77d4953e 757 'legacy' => array(
77d4953e 758 'student' => CAP_ALLOW,
759 'teacher' => CAP_ALLOW,
760 'editingteacher' => CAP_ALLOW,
77d4953e 761 'admin' => CAP_ALLOW
762 )
763 ),
eef868d1 764
77d4953e 765 'moodle/user:readuserblogs' => array(
bcdb0f19 766
77d4953e 767 'captype' => 'read',
4b10f08b 768 'contextlevel' => CONTEXT_USER,
77d4953e 769 'legacy' => array(
77d4953e 770 'student' => CAP_ALLOW,
771 'teacher' => CAP_ALLOW,
772 'editingteacher' => CAP_ALLOW,
77d4953e 773 'admin' => CAP_ALLOW
774 )
775 ),
eef868d1 776
77d4953e 777 'moodle/user:viewuseractivitiesreport' => array(
bcdb0f19 778
77d4953e 779 'captype' => 'read',
4b10f08b 780 'contextlevel' => CONTEXT_USER,
77d4953e 781 'legacy' => array(
77d4953e 782 'teacher' => CAP_ALLOW,
783 'editingteacher' => CAP_ALLOW,
77d4953e 784 'admin' => CAP_ALLOW
785 )
945f88ca 786 ),
eef868d1 787
945f88ca 788 'moodle/question:import' => array(
21b6db6e 789
790 'riskbitmask' => RISK_XSS,
791
945f88ca 792 'captype' => 'write',
793 'contextlevel' => CONTEXT_COURSE,
794 'legacy' => array(
945f88ca 795 'editingteacher' => CAP_ALLOW,
945f88ca 796 'admin' => CAP_ALLOW
797 )
798 ),
eef868d1 799
945f88ca 800 'moodle/question:export' => array(
bcdb0f19 801
945f88ca 802 'captype' => 'read',
803 'contextlevel' => CONTEXT_COURSE,
804 'legacy' => array(
945f88ca 805 'editingteacher' => CAP_ALLOW,
945f88ca 806 'admin' => CAP_ALLOW
807 )
808 ),
eef868d1 809
f43ce1ad 810 'moodle/question:managecategory' => array(
bcdb0f19 811
945f88ca 812 'captype' => 'write',
813 'contextlevel' => CONTEXT_COURSE,
814 'legacy' => array(
945f88ca 815 'editingteacher' => CAP_ALLOW,
945f88ca 816 'admin' => CAP_ALLOW
817 )
818 ),
eef868d1 819
945f88ca 820 'moodle/question:manage' => array(
21b6db6e 821
822 'riskbitmask' => RISK_XSS,
823
945f88ca 824 'captype' => 'write',
825 'contextlevel' => CONTEXT_COURSE,
826 'legacy' => array(
945f88ca 827 'editingteacher' => CAP_ALLOW,
945f88ca 828 'admin' => CAP_ALLOW
829 )
7191a1fa 830 ),
831
0eb6b04a 832 // Configure the installed question types.
833 'moodle/question:config' => array(
834
835 'riskbitmask' => RISK_CONFIG,
836
837 'captype' => 'write',
838 'contextlevel' => CONTEXT_SYSTEM,
839 'legacy' => array(
840 'admin' => CAP_ALLOW
841 )
842 ),
843
7191a1fa 844 'moodle/site:doclinks' => array(
bcdb0f19 845
7191a1fa 846 'captype' => 'read',
847 'contextlevel' => CONTEXT_SYSTEM,
848 'legacy' => array(
7191a1fa 849 'teacher' => CAP_ALLOW,
850 'editingteacher' => CAP_ALLOW,
7191a1fa 851 'admin' => CAP_ALLOW
852 )
3924b988 853 ),
eef868d1 854
3924b988 855 'moodle/course:sectionvisibility' => array(
bcdb0f19 856
3924b988 857 'captype' => 'write',
858 'contextlevel' => CONTEXT_COURSE,
859 'legacy' => array(
3924b988 860 'editingteacher' => CAP_ALLOW,
3924b988 861 'admin' => CAP_ALLOW
862 )
863 ),
eef868d1 864
dc558690 865 'moodle/course:useremail' => array(
bcdb0f19 866
dc558690 867 'captype' => 'write',
868 'contextlevel' => CONTEXT_COURSE,
869 'legacy' => array(
dc558690 870 'editingteacher' => CAP_ALLOW,
dc558690 871 'admin' => CAP_ALLOW
872 )
873 ),
eef868d1 874
3924b988 875 'moodle/course:viewhiddensections' => array(
bcdb0f19 876
3924b988 877 'captype' => 'write',
878 'contextlevel' => CONTEXT_COURSE,
879 'legacy' => array(
3924b988 880 'editingteacher' => CAP_ALLOW,
3924b988 881 'admin' => CAP_ALLOW
882 )
883 ),
eef868d1 884
3924b988 885 'moodle/course:setcurrentsection' => array(
bcdb0f19 886
3924b988 887 'captype' => 'write',
888 'contextlevel' => CONTEXT_COURSE,
889 'legacy' => array(
3924b988 890 'editingteacher' => CAP_ALLOW,
3924b988 891 'admin' => CAP_ALLOW
892 )
893 ),
eef868d1 894
3924b988 895 'moodle/course:viewcoursegrades' => array(
bcdb0f19 896
897 'riskbitmask' => RISK_PERSONAL,
898
3924b988 899 'captype' => 'read',
900 'contextlevel' => CONTEXT_COURSE,
901 'legacy' => array(
3924b988 902 'teacher' => CAP_ALLOW,
903 'editingteacher' => CAP_ALLOW,
3924b988 904 'admin' => CAP_ALLOW
905 )
906 ),
eef868d1 907
3924b988 908 'moodle/course:managegrades' => array(
bcdb0f19 909
910 'riskbitmask' => RISK_PERSONAL,
911
3924b988 912 'captype' => 'write',
913 'contextlevel' => CONTEXT_COURSE,
914 'legacy' => array(
3924b988 915 'editingteacher' => CAP_ALLOW,
3924b988 916 'admin' => CAP_ALLOW
917 )
f509ce06 918 ),
f43ce1ad 919
f509ce06 920 'moodle/site:mnetlogintoremote' => array(
921 'riskbitmask' => RISK_PERSONAL | RISK_XSS,
922 'captype' => 'read',
923 'contextlevel' => CONTEXT_SYSTEM,
924 'legacy' => array(
925 'admin' => CAP_ALLOW
926 )
927 )
bbbf2d40 928);
929
930?>