ROLES AND PERMISSIONS - FIRST CHECK-IN
[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(
35
36 'moodle/site:doanything' => array(
37 'captype' => 'admin',
38 'contextlevel' => CONTEXT_SYSTEM
39 ),
40
41 'moodle/legacy:guest' => array(
42 'captype' => 'legacy',
43 'contextlevel' => CONTEXT_SYSTEM
44 ),
45
46
47 'moodle/legacy:student' => array(
48 'captype' => 'legacy',
49 'contextlevel' => CONTEXT_SYSTEM
50 ),
51
52
53 'moodle/legacy:teacher' => array(
54 'captype' => 'legacy',
55 'contextlevel' => CONTEXT_SYSTEM
56 ),
57
58
59 'moodle/legacy:editingteacher' => array(
60 'captype' => 'legacy',
61 'contextlevel' => CONTEXT_SYSTEM
62 ),
63
64
65 'moodle/legacy:coursecreator' => array(
66 'captype' => 'legacy',
67 'contextlevel' => CONTEXT_SYSTEM
68 ),
69
70
71 'moodle/legacy:admin' => array(
72 'captype' => 'legacy',
73 'contextlevel' => CONTEXT_SYSTEM
74 ),
75
76
77 'moodle/site:config' => array(
78
79 'captype' => 'write',
80 'contextlevel' => CONTEXT_SYSTEM,
81 'legacy' => array(
82 'guest' => CAP_PREVENT,
83 'student' => CAP_PREVENT,
84 'teacher' => CAP_PREVENT,
85 'editingteacher' => CAP_PREVENT,
86 'coursecreator' => CAP_PREVENT,
87 'admin' => CAP_ALLOW
88 )
89 ),
90
91 'moodle/site:import' => array(
92
93 'captype' => 'write',
94 'contextlevel' => CONTEXT_SYSTEM,
95 'legacy' => array(
96 'guest' => CAP_PREVENT,
97 'student' => CAP_PREVENT,
98 'teacher' => CAP_PREVENT,
99 'editingteacher' => CAP_PREVENT,
100 'coursecreator' => CAP_PREVENT,
101 'admin' => CAP_ALLOW
102 )
103 ),
104
105 'moodle/site:backup' => array(
106
107 'captype' => 'write',
108 'contextlevel' => CONTEXT_SYSTEM,
109 'legacy' => array(
110 'guest' => CAP_PREVENT,
111 'student' => CAP_PREVENT,
112 'teacher' => CAP_PREVENT,
113 'editingteacher' => CAP_PREVENT,
114 'coursecreator' => CAP_PREVENT,
115 'admin' => CAP_ALLOW
116 )
117 ),
118
119 'moodle/site:restore' => array(
120
121 'captype' => 'write',
122 'contextlevel' => CONTEXT_SYSTEM,
123 'legacy' => array(
124 'guest' => CAP_PREVENT,
125 'student' => CAP_PREVENT,
126 'teacher' => CAP_PREVENT,
127 'editingteacher' => CAP_PREVENT,
128 'coursecreator' => CAP_PREVENT,
129 'admin' => CAP_ALLOW
130 )
131 ),
132
133 'moodle/site:manageblocks' => array(
134
135 'captype' => 'write',
136 'contextlevel' => CONTEXT_SYSTEM,
137 'legacy' => array(
138 'guest' => CAP_PREVENT,
139 'student' => CAP_PREVENT,
140 'teacher' => CAP_PREVENT,
141 'editingteacher' => CAP_PREVENT,
142 'coursecreator' => CAP_PREVENT,
143 'admin' => CAP_ALLOW
144 )
145 ),
146
147 'moodle/user:create' => array(
148
149 'captype' => 'write',
150 'contextlevel' => CONTEXT_SYSTEM,
151 'legacy' => array(
152 'guest' => CAP_PREVENT,
153 'student' => CAP_PREVENT,
154 'teacher' => CAP_PREVENT,
155 'editingteacher' => CAP_PREVENT,
156 'coursecreator' => CAP_PREVENT,
157 'admin' => CAP_ALLOW
158 )
159 ),
160
161 'moodle/user:delete' => array(
162
163 'captype' => 'write',
164 'contextlevel' => CONTEXT_SYSTEM,
165 'legacy' => array(
166 'guest' => CAP_PREVENT,
167 'student' => CAP_PREVENT,
168 'teacher' => CAP_PREVENT,
169 'editingteacher' => CAP_PREVENT,
170 'coursecreator' => CAP_PREVENT,
171 'admin' => CAP_ALLOW
172 )
173 ),
174
175 'moodle/user:update' => array(
176
177 'captype' => 'write',
178 'contextlevel' => CONTEXT_SYSTEM,
179 'legacy' => array(
180 'guest' => CAP_PREVENT,
181 'student' => CAP_PREVENT,
182 'teacher' => CAP_PREVENT,
183 'editingteacher' => CAP_PREVENT,
184 'coursecreator' => CAP_PREVENT,
185 'admin' => CAP_ALLOW
186 )
187 ),
188
189 'moodle/user:viewdetails' => array(
190
191 'captype' => 'write',
192 'contextlevel' => CONTEXT_SYSTEM,
193 'legacy' => array(
194 'guest' => CAP_PREVENT,
195 'student' => CAP_ALLOW,
196 'teacher' => CAP_ALLOW,
197 'editingteacher' => CAP_ALLOW,
198 'coursecreator' => CAP_ALLOW,
199 'admin' => CAP_ALLOW
200 )
201 ),
202
203 'moodle/role:assign' => array(
204
205 'captype' => 'write',
206 'contextlevel' => CONTEXT_SYSTEM,
207 'legacy' => array(
208 'guest' => CAP_PREVENT,
209 'student' => CAP_PREVENT,
210 'teacher' => CAP_PREVENT,
211 'editingteacher' => CAP_PREVENT,
212 'coursecreator' => CAP_PREVENT,
213 'admin' => CAP_ALLOW
214 )
215 ),
216
217 'moodle/role:manage' => array(
218
219 'captype' => 'write',
220 'contextlevel' => CONTEXT_SYSTEM,
221 'legacy' => array(
222 'guest' => CAP_PREVENT,
223 'student' => CAP_PREVENT,
224 'teacher' => CAP_PREVENT,
225 'editingteacher' => CAP_PREVENT,
226 'coursecreator' => CAP_PREVENT,
227 'admin' => CAP_ALLOW
228 )
229 ),
230
231 'moodle/category:create' => array(
232
233 'captype' => 'write',
234 'contextlevel' => CONTEXT_COURSECAT,
235 'legacy' => array(
236 'guest' => CAP_PREVENT,
237 'student' => CAP_PREVENT,
238 'teacher' => CAP_PREVENT,
239 'editingteacher' => CAP_PREVENT,
240 'coursecreator' => CAP_PREVENT,
241 'admin' => CAP_ALLOW
242 )
243 ),
244
245 'moodle/category:delete' => array(
246
247 'captype' => 'write',
248 'contextlevel' => CONTEXT_COURSECAT,
249 'legacy' => array(
250 'guest' => CAP_PREVENT,
251 'student' => CAP_PREVENT,
252 'teacher' => CAP_PREVENT,
253 'editingteacher' => CAP_PREVENT,
254 'coursecreator' => CAP_PREVENT,
255 'admin' => CAP_ALLOW
256 )
257 ),
258
259 'moodle/category:update' => array(
260
261 'captype' => 'write',
262 'contextlevel' => CONTEXT_COURSECAT,
263 'legacy' => array(
264 'guest' => CAP_PREVENT,
265 'student' => CAP_PREVENT,
266 'teacher' => CAP_PREVENT,
267 'editingteacher' => CAP_PREVENT,
268 'coursecreator' => CAP_PREVENT,
269 'admin' => CAP_ALLOW
270 )
271 ),
272
273 'moodle/category:visibility' => array(
274
275 'captype' => 'write',
276 'contextlevel' => CONTEXT_COURSECAT,
277 'legacy' => array(
278 'guest' => CAP_PREVENT,
279 'student' => CAP_PREVENT,
280 'teacher' => CAP_PREVENT,
281 'editingteacher' => CAP_PREVENT,
282 'coursecreator' => CAP_PREVENT,
283 'admin' => CAP_ALLOW
284 )
285 ),
286
287 'moodle/course:create' => array(
288
289 'captype' => 'write',
290 'contextlevel' => CONTEXT_COURSE,
291 'legacy' => array(
292 'guest' => CAP_PREVENT,
293 'student' => CAP_PREVENT,
294 'teacher' => CAP_PREVENT,
295 'editingteacher' => CAP_PREVENT,
296 'coursecreator' => CAP_PREVENT,
297 'admin' => CAP_ALLOW
298 )
299 ),
300
301 'moodle/course:delete' => array(
302
303 'captype' => 'write',
304 'contextlevel' => CONTEXT_COURSE,
305 'legacy' => array(
306 'guest' => CAP_PREVENT,
307 'student' => CAP_PREVENT,
308 'teacher' => CAP_PREVENT,
309 'editingteacher' => CAP_PREVENT,
310 'coursecreator' => CAP_PREVENT,
311 'admin' => CAP_ALLOW
312 )
313 ),
314
315 'moodle/course:update' => array(
316
317 'captype' => 'write',
318 'contextlevel' => CONTEXT_COURSE,
319 'legacy' => array(
320 'guest' => CAP_PREVENT,
321 'student' => CAP_PREVENT,
322 'teacher' => CAP_PREVENT,
323 'editingteacher' => CAP_ALLOW,
324 'coursecreator' => CAP_ALLOW,
325 'admin' => CAP_ALLOW
326 )
327 ),
328
329 'moodle/course:view' => array(
330
331 'captype' => 'read',
332 'contextlevel' => CONTEXT_COURSE,
333 'legacy' => array(
334 'guest' => CAP_PREVENT,
335 'student' => CAP_ALLOW,
336 'teacher' => CAP_ALLOW,
337 'editingteacher' => CAP_ALLOW,
338 'coursecreator' => CAP_ALLOW,
339 'admin' => CAP_ALLOW
340 )
341 ),
342
343 'moodle/course:visibility' => array(
344
345 'captype' => 'write',
346 'contextlevel' => CONTEXT_COURSE,
347 'legacy' => array(
348 'guest' => CAP_PREVENT,
349 'student' => CAP_PREVENT,
350 'teacher' => CAP_PREVENT,
351 'editingteacher' => CAP_PREVENT,
352 'coursecreator' => CAP_ALLOW,
353 'admin' => CAP_ALLOW
354 )
355 ),
356
357 'moodle/course:manageactivities' => array(
358
359 'captype' => 'write',
360 'contextlevel' => CONTEXT_COURSE,
361 'legacy' => array(
362 'guest' => CAP_PREVENT,
363 'student' => CAP_PREVENT,
364 'teacher' => CAP_ALLOW,
365 'editingteacher' => CAP_ALLOW,
366 'coursecreator' => CAP_ALLOW,
367 'admin' => CAP_ALLOW
368 )
369 ),
370
371 'moodle/course:activityvisibility' => array(
372
373 'captype' => 'write',
374 'contextlevel' => CONTEXT_COURSE,
375 'legacy' => array(
376 'guest' => CAP_PREVENT,
377 'student' => CAP_PREVENT,
378 'teacher' => CAP_PREVENT,
379 'editingteacher' => CAP_ALLOW,
380 'coursecreator' => CAP_ALLOW,
381 'admin' => CAP_ALLOW
382 )
383 ),
384
385 'moodle/course:viewhiddenactivities' => array(
386
387 'captype' => 'write',
388 'contextlevel' => CONTEXT_COURSE,
389 'legacy' => array(
390 'guest' => CAP_PREVENT,
391 'student' => CAP_PREVENT,
392 'teacher' => CAP_ALLOW,
393 'editingteacher' => CAP_ALLOW,
394 'coursecreator' => CAP_ALLOW,
395 'admin' => CAP_ALLOW
396 )
397 ),
398
399 'moodle/course:viewparticipants' => array(
400
401 'captype' => 'read',
402 'contextlevel' => CONTEXT_COURSE,
403 'legacy' => array(
404 'guest' => CAP_PREVENT,
405 'student' => CAP_ALLOW,
406 'teacher' => CAP_ALLOW,
407 'editingteacher' => CAP_ALLOW,
408 'coursecreator' => CAP_ALLOW,
409 'admin' => CAP_ALLOW
410 )
411 ),
412
413 'moodle/course:viewscales' => array(
414
415 'captype' => 'read',
416 'contextlevel' => CONTEXT_COURSE,
417 'legacy' => array(
418 'guest' => CAP_PREVENT,
419 'student' => CAP_ALLOW,
420 'teacher' => CAP_ALLOW,
421 'editingteacher' => CAP_ALLOW,
422 'coursecreator' => CAP_ALLOW,
423 'admin' => CAP_ALLOW
424 )
425 ),
426
427 'moodle/course:managescales' => array(
428
429 'captype' => 'write',
430 'contextlevel' => CONTEXT_COURSE,
431 'legacy' => array(
432 'guest' => CAP_PREVENT,
433 'student' => CAP_PREVENT,
434 'teacher' => CAP_PREVENT,
435 'editingteacher' => CAP_ALLOW,
436 'coursecreator' => CAP_ALLOW,
437 'admin' => CAP_ALLOW
438 )
439 ),
440
441 'moodle/course:managegroups' => array(
442
443 'captype' => 'write',
444 'contextlevel' => CONTEXT_COURSE,
445 'legacy' => array(
446 'guest' => CAP_PREVENT,
447 'student' => CAP_PREVENT,
448 'teacher' => CAP_PREVENT,
449 'editingteacher' => CAP_ALLOW,
450 'coursecreator' => CAP_ALLOW,
451 'admin' => CAP_ALLOW
452 )
453 ),
454
455 'moodle/blog:view' => array(
456
457 'captype' => 'read',
458 'contextlevel' => CONTEXT_SYSTEM,
459 'legacy' => array(
460 'guest' => CAP_PREVENT,
461 'student' => CAP_ALLOW,
462 'teacher' => CAP_ALLOW,
463 'editingteacher' => CAP_ALLOW,
464 'coursecreator' => CAP_ALLOW,
465 'admin' => CAP_ALLOW
466 )
467 ),
468
469 'moodle/blog:create' => array(
470
471 'captype' => 'write',
472 'contextlevel' => CONTEXT_SYSTEM,
473 'legacy' => array(
474 'guest' => CAP_PREVENT,
475 'student' => CAP_ALLOW,
476 'teacher' => CAP_ALLOW,
477 'editingteacher' => CAP_ALLOW,
478 'coursecreator' => CAP_ALLOW,
479 'admin' => CAP_ALLOW
480 )
481 ),
482
483 'moodle/blog:manageofficialtags' => array(
484
485 'captype' => 'write',
486 'contextlevel' => CONTEXT_SYSTEM,
487 'legacy' => array(
488 'guest' => CAP_PREVENT,
489 'student' => CAP_PREVENT,
490 'teacher' => CAP_PREVENT,
491 'editingteacher' => CAP_PREVENT,
492 'coursecreator' => CAP_PREVENT,
493 'admin' => CAP_ALLOW
494 )
495 ),
496
497 'moodle/blog:managepersonaltags' => array(
498
499 'captype' => 'write',
500 'contextlevel' => CONTEXT_SYSTEM,
501 'legacy' => array(
502 'guest' => CAP_PREVENT,
503 'student' => CAP_ALLOW,
504 'teacher' => CAP_ALLOW,
505 'editingteacher' => CAP_ALLOW,
506 'coursecreator' => CAP_ALLOW,
507 'admin' => CAP_ALLOW
508 )
509 ),
510
511 'moodle/blog:manageentries' => array(
512
513 'captype' => 'write',
514 'contextlevel' => CONTEXT_SYSTEM,
515 'legacy' => array(
516 'guest' => CAP_PREVENT,
517 'student' => CAP_PREVENT,
518 'teacher' => CAP_ALLOW,
519 'editingteacher' => CAP_ALLOW,
520 'coursecreator' => CAP_ALLOW,
521 'admin' => CAP_ALLOW
522 )
523 ),
524
525 'moodle/calendar:manageownentries' => array(
526
527 'captype' => 'write',
528 'contextlevel' => CONTEXT_SYSTEM,
529 'legacy' => array(
530 'guest' => CAP_PREVENT,
531 'student' => CAP_ALLOW,
532 'teacher' => CAP_ALLOW,
533 'editingteacher' => CAP_ALLOW,
534 'coursecreator' => CAP_ALLOW,
535 'admin' => CAP_ALLOW
536 )
537 ),
538
539 'moodle/calendar:manageentries' => array(
540
541 'captype' => 'write',
542 'contextlevel' => CONTEXT_SYSTEM,
543 'legacy' => array(
544 'guest' => CAP_PREVENT,
545 'student' => CAP_PREVENT,
546 'teacher' => CAP_ALLOW,
547 'editingteacher' => CAP_ALLOW,
548 'coursecreator' => CAP_ALLOW,
549 'admin' => CAP_ALLOW
550 )
551 )
552
553);
554
555?>