MDL-27735 Q&A forum: add new caps to add question. By default, teacher, editing teach...
[moodle.git] / mod / forum / db / access.php
CommitLineData
bbbf2d40 1<?php
8f685009
SH
2
3// This file is part of Moodle - http://moodle.org/
bbbf2d40 4//
8f685009
SH
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
bbbf2d40 9//
8f685009
SH
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
bbbf2d40 14//
8f685009
SH
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
bbbf2d40 17
8f685009
SH
18/**
19 * Capability definitions for the forum module.
2f67a9b3 20 *
8f685009
SH
21 * The capabilities are loaded into the database table when the module is
22 * installed or updated. Whenever the capability definitions are updated,
23 * the module version number should be bumped up.
24 *
25 * The system has four possible values for a capability:
26 * CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
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 * @package mod-forum
46 * @copyright 2006 vyshane
47 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
48 */
bbbf2d40 49
0ac940b3 50$capabilities = array(
eef868d1 51
bbbf2d40 52 'mod/forum:viewdiscussion' => array(
eef868d1 53
bbbf2d40 54 'captype' => 'read',
55 'contextlevel' => CONTEXT_MODULE,
31c93303 56 'archetypes' => array(
4f0c2d00 57 'frontpage' => CAP_ALLOW, // needed especially for news on the frontpage
00adf177 58 'guest' => CAP_ALLOW,
bbbf2d40 59 'student' => CAP_ALLOW,
60 'teacher' => CAP_ALLOW,
61 'editingteacher' => CAP_ALLOW,
4f0c2d00 62 'manager' => CAP_ALLOW
bbbf2d40 63 )
64 ),
eef868d1 65
f0eb2ffe 66 'mod/forum:viewhiddentimedposts' => array(
eef868d1 67
f0eb2ffe 68 'captype' => 'read',
69 'contextlevel' => CONTEXT_MODULE,
31c93303 70 'archetypes' => array(
f0eb2ffe 71 'teacher' => CAP_ALLOW,
72 'editingteacher' => CAP_ALLOW,
4f0c2d00 73 'manager' => CAP_ALLOW
f0eb2ffe 74 )
75 ),
eef868d1 76
bbbf2d40 77 'mod/forum:startdiscussion' => array(
eef868d1 78
21b6db6e 79 'riskbitmask' => RISK_SPAM,
80
81 'captype' => 'write',
bbbf2d40 82 'contextlevel' => CONTEXT_MODULE,
31c93303 83 'archetypes' => array(
bbbf2d40 84 'student' => CAP_ALLOW,
85 'teacher' => CAP_ALLOW,
86 'editingteacher' => CAP_ALLOW,
4f0c2d00 87 'manager' => CAP_ALLOW
bbbf2d40 88 )
89 ),
eef868d1 90
bbbf2d40 91 'mod/forum:replypost' => array(
eef868d1 92
21b6db6e 93 'riskbitmask' => RISK_SPAM,
94
95 'captype' => 'write',
bbbf2d40 96 'contextlevel' => CONTEXT_MODULE,
31c93303 97 'archetypes' => array(
bbbf2d40 98 'student' => CAP_ALLOW,
99 'teacher' => CAP_ALLOW,
100 'editingteacher' => CAP_ALLOW,
4f0c2d00 101 'manager' => CAP_ALLOW
bbbf2d40 102 )
103 ),
eef868d1 104
c718dd57 105 'mod/forum:addnews' => array(
106
107 'riskbitmask' => RISK_SPAM,
108
109 'captype' => 'write',
110 'contextlevel' => CONTEXT_MODULE,
31c93303 111 'archetypes' => array(
c718dd57 112 'teacher' => CAP_ALLOW,
113 'editingteacher' => CAP_ALLOW,
4f0c2d00 114 'manager' => CAP_ALLOW
c718dd57 115 )
116 ),
117
118 'mod/forum:replynews' => array(
119
120 'riskbitmask' => RISK_SPAM,
121
122 'captype' => 'write',
123 'contextlevel' => CONTEXT_MODULE,
31c93303 124 'archetypes' => array(
c718dd57 125 'teacher' => CAP_ALLOW,
126 'editingteacher' => CAP_ALLOW,
4f0c2d00 127 'manager' => CAP_ALLOW
c718dd57 128 )
129 ),
130
bbbf2d40 131 'mod/forum:viewrating' => array(
eef868d1 132
bbbf2d40 133 'captype' => 'read',
134 'contextlevel' => CONTEXT_MODULE,
31c93303 135 'archetypes' => array(
bbbf2d40 136 'student' => CAP_ALLOW,
137 'teacher' => CAP_ALLOW,
138 'editingteacher' => CAP_ALLOW,
4f0c2d00 139 'manager' => CAP_ALLOW
bbbf2d40 140 )
141 ),
eef868d1 142
bbbf2d40 143 'mod/forum:viewanyrating' => array(
eef868d1 144
6595a568 145 'riskbitmask' => RISK_PERSONAL,
bbbf2d40 146 'captype' => 'read',
147 'contextlevel' => CONTEXT_MODULE,
31c93303 148 'archetypes' => array(
bbbf2d40 149 'teacher' => CAP_ALLOW,
150 'editingteacher' => CAP_ALLOW,
4f0c2d00 151 'manager' => CAP_ALLOW
bbbf2d40 152 )
153 ),
eef868d1 154
6595a568
MD
155 'mod/forum:viewallratings' => array(
156
157 'riskbitmask' => RISK_PERSONAL,
158 'captype' => 'read',
159 'contextlevel' => CONTEXT_MODULE,
31c93303 160 'archetypes' => array(
6595a568
MD
161 'teacher' => CAP_ALLOW,
162 'editingteacher' => CAP_ALLOW,
163 'manager' => CAP_ALLOW
164 ),
165 'clonepermissionsfrom' => 'mod/forum:viewanyrating'
166 ),
167
bbbf2d40 168 'mod/forum:rate' => array(
eef868d1 169
21b6db6e 170 'captype' => 'write',
bbbf2d40 171 'contextlevel' => CONTEXT_MODULE,
31c93303 172 'archetypes' => array(
bbbf2d40 173 'teacher' => CAP_ALLOW,
174 'editingteacher' => CAP_ALLOW,
4f0c2d00 175 'manager' => CAP_ALLOW
bbbf2d40 176 )
177 ),
eef868d1 178
bbbf2d40 179 'mod/forum:createattachment' => array(
eef868d1 180
21b6db6e 181 'riskbitmask' => RISK_SPAM,
182
183 'captype' => 'write',
bbbf2d40 184 'contextlevel' => CONTEXT_MODULE,
31c93303 185 'archetypes' => array(
bbbf2d40 186 'student' => CAP_ALLOW,
187 'teacher' => CAP_ALLOW,
188 'editingteacher' => CAP_ALLOW,
4f0c2d00 189 'manager' => CAP_ALLOW
bbbf2d40 190 )
191 ),
eef868d1 192
bbbf2d40 193 'mod/forum:deleteownpost' => array(
eef868d1 194
bbbf2d40 195 'captype' => 'read',
196 'contextlevel' => CONTEXT_MODULE,
31c93303 197 'archetypes' => array(
bbbf2d40 198 'student' => CAP_ALLOW,
199 'teacher' => CAP_ALLOW,
200 'editingteacher' => CAP_ALLOW,
4f0c2d00 201 'manager' => CAP_ALLOW
bbbf2d40 202 )
203 ),
eef868d1 204
bbbf2d40 205 'mod/forum:deleteanypost' => array(
eef868d1 206
bbbf2d40 207 'captype' => 'read',
208 'contextlevel' => CONTEXT_MODULE,
31c93303 209 'archetypes' => array(
bbbf2d40 210 'teacher' => CAP_ALLOW,
211 'editingteacher' => CAP_ALLOW,
4f0c2d00 212 'manager' => CAP_ALLOW
bbbf2d40 213 )
214 ),
eef868d1 215
bbbf2d40 216 'mod/forum:splitdiscussions' => array(
eef868d1 217
bbbf2d40 218 'captype' => 'read',
219 'contextlevel' => CONTEXT_MODULE,
31c93303 220 'archetypes' => array(
bbbf2d40 221 'teacher' => CAP_ALLOW,
222 'editingteacher' => CAP_ALLOW,
4f0c2d00 223 'manager' => CAP_ALLOW
bbbf2d40 224 )
225 ),
eef868d1 226
bbbf2d40 227 'mod/forum:movediscussions' => array(
eef868d1 228
bbbf2d40 229 'captype' => 'read',
230 'contextlevel' => CONTEXT_MODULE,
31c93303 231 'archetypes' => array(
bbbf2d40 232 'teacher' => CAP_ALLOW,
233 'editingteacher' => CAP_ALLOW,
4f0c2d00 234 'manager' => CAP_ALLOW
bbbf2d40 235 )
236 ),
eef868d1 237
bbbf2d40 238 'mod/forum:editanypost' => array(
eef868d1 239
21b6db6e 240 'riskbitmask' => RISK_SPAM,
241
242 'captype' => 'write',
bbbf2d40 243 'contextlevel' => CONTEXT_MODULE,
31c93303 244 'archetypes' => array(
bbbf2d40 245 'teacher' => CAP_ALLOW,
246 'editingteacher' => CAP_ALLOW,
4f0c2d00 247 'manager' => CAP_ALLOW
bbbf2d40 248 )
249 ),
eef868d1 250
bbbf2d40 251 'mod/forum:viewqandawithoutposting' => array(
eef868d1 252
bbbf2d40 253 'captype' => 'read',
254 'contextlevel' => CONTEXT_MODULE,
31c93303 255 'archetypes' => array(
bbbf2d40 256 'teacher' => CAP_ALLOW,
257 'editingteacher' => CAP_ALLOW,
4f0c2d00 258 'manager' => CAP_ALLOW
bbbf2d40 259 )
260 ),
eef868d1 261
bbbf2d40 262 'mod/forum:viewsubscribers' => array(
eef868d1 263
bbbf2d40 264 'captype' => 'read',
265 'contextlevel' => CONTEXT_MODULE,
31c93303 266 'archetypes' => array(
bbbf2d40 267 'teacher' => CAP_ALLOW,
268 'editingteacher' => CAP_ALLOW,
4f0c2d00 269 'manager' => CAP_ALLOW
bbbf2d40 270 )
271 ),
eef868d1 272
bbbf2d40 273 'mod/forum:managesubscriptions' => array(
eef868d1 274
3a0c6cca 275 'riskbitmask' => RISK_SPAM,
276
bbbf2d40 277 'captype' => 'read',
278 'contextlevel' => CONTEXT_MODULE,
31c93303 279 'archetypes' => array(
bbbf2d40 280 'teacher' => CAP_ALLOW,
281 'editingteacher' => CAP_ALLOW,
4f0c2d00 282 'manager' => CAP_ALLOW
bbbf2d40 283 )
0fa18d5a 284 ),
eef868d1 285
d4514e46 286 'mod/forum:postwithoutthrottling' => array(
d43d749a 287
288 'riskbitmask' => RISK_SPAM,
eef868d1 289
0fa18d5a 290 'captype' => 'write',
291 'contextlevel' => CONTEXT_MODULE,
31c93303 292 'archetypes' => array(
d4514e46
AD
293 'teacher' => CAP_ALLOW,
294 'editingteacher' => CAP_ALLOW,
295 'manager' => CAP_ALLOW
0fa18d5a 296 )
f98b13a6 297 ),
298
299 'mod/forum:exportdiscussion' => array(
bbbf2d40 300
f98b13a6 301 'riskbitmask' => RISK_PERSONAL,
302
303 'captype' => 'read',
304 'contextlevel' => CONTEXT_MODULE,
31c93303 305 'archetypes' => array(
f98b13a6 306 'teacher' => CAP_ALLOW,
307 'editingteacher' => CAP_ALLOW,
4f0c2d00 308 'manager' => CAP_ALLOW
f98b13a6 309 )
310 ),
311 'mod/forum:exportpost' => array(
312
313 'riskbitmask' => RISK_PERSONAL,
314
315 'captype' => 'read',
316 'contextlevel' => CONTEXT_MODULE,
31c93303 317 'archetypes' => array(
f98b13a6 318 'teacher' => CAP_ALLOW,
319 'editingteacher' => CAP_ALLOW,
4f0c2d00 320 'manager' => CAP_ALLOW
f98b13a6 321 )
322 ),
323 'mod/forum:exportownpost' => array(
324
325 'riskbitmask' => RISK_PERSONAL,
326
327 'captype' => 'read',
328 'contextlevel' => CONTEXT_MODULE,
31c93303 329 'archetypes' => array(
f98b13a6 330 'teacher' => CAP_ALLOW,
331 'editingteacher' => CAP_ALLOW,
4f0c2d00 332 'manager' => CAP_ALLOW,
f98b13a6 333 'student' => CAP_ALLOW,
334 )
335 ),
db8312d2
RW
336 'mod/forum:addquestion' => array(
337
338 'riskbitmask' => RISK_SPAM,
339
340 'captype' => 'write',
341 'contextlevel' => CONTEXT_MODULE,
342 'archetypes' => array(
343 'teacher' => CAP_ALLOW,
344 'editingteacher' => CAP_ALLOW,
345 'manager' => CAP_ALLOW
346 )
347 ),
f98b13a6 348);
1adbd2c3 349