1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Capability definitions for the quiz module.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_quiz
|
|
|
21 |
* @copyright 2006 The Open University
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
defined('MOODLE_INTERNAL') || die();
|
|
|
26 |
|
|
|
27 |
$capabilities = [
|
|
|
28 |
|
|
|
29 |
// Ability to see that the quiz exists, and the basic information
|
|
|
30 |
// about it, for example the start date and time limit.
|
|
|
31 |
'mod/quiz:view' => [
|
|
|
32 |
'captype' => 'read',
|
|
|
33 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
34 |
'archetypes' => [
|
|
|
35 |
'guest' => CAP_ALLOW,
|
|
|
36 |
'student' => CAP_ALLOW,
|
|
|
37 |
'teacher' => CAP_ALLOW,
|
|
|
38 |
'editingteacher' => CAP_ALLOW,
|
|
|
39 |
'manager' => CAP_ALLOW
|
|
|
40 |
]
|
|
|
41 |
],
|
|
|
42 |
|
|
|
43 |
// Ability to add a new quiz to the course.
|
|
|
44 |
'mod/quiz:addinstance' => [
|
|
|
45 |
'riskbitmask' => RISK_XSS,
|
|
|
46 |
|
|
|
47 |
'captype' => 'write',
|
|
|
48 |
'contextlevel' => CONTEXT_COURSE,
|
|
|
49 |
'archetypes' => [
|
|
|
50 |
'editingteacher' => CAP_ALLOW,
|
|
|
51 |
'manager' => CAP_ALLOW
|
|
|
52 |
],
|
|
|
53 |
'clonepermissionsfrom' => 'moodle/course:manageactivities'
|
|
|
54 |
],
|
|
|
55 |
|
|
|
56 |
// Ability to do the quiz as a 'student'.
|
|
|
57 |
'mod/quiz:attempt' => [
|
|
|
58 |
'riskbitmask' => RISK_SPAM,
|
|
|
59 |
'captype' => 'write',
|
|
|
60 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
61 |
'archetypes' => [
|
|
|
62 |
'student' => CAP_ALLOW
|
|
|
63 |
]
|
|
|
64 |
],
|
|
|
65 |
|
|
|
66 |
// Ability for a 'Student' to review their previous attempts. Review by
|
|
|
67 |
// 'Teachers' is controlled by mod/quiz:viewreports.
|
|
|
68 |
'mod/quiz:reviewmyattempts' => [
|
|
|
69 |
'captype' => 'read',
|
|
|
70 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
71 |
'archetypes' => [
|
|
|
72 |
'student' => CAP_ALLOW
|
|
|
73 |
],
|
|
|
74 |
'clonepermissionsfrom' => 'moodle/quiz:attempt'
|
|
|
75 |
],
|
|
|
76 |
|
|
|
77 |
// Edit the quiz settings, add and remove questions.
|
|
|
78 |
'mod/quiz:manage' => [
|
|
|
79 |
'riskbitmask' => RISK_SPAM,
|
|
|
80 |
'captype' => 'write',
|
|
|
81 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
82 |
'archetypes' => [
|
|
|
83 |
'editingteacher' => CAP_ALLOW,
|
|
|
84 |
'manager' => CAP_ALLOW
|
|
|
85 |
]
|
|
|
86 |
],
|
|
|
87 |
|
|
|
88 |
// Edit the quiz overrides.
|
|
|
89 |
'mod/quiz:manageoverrides' => [
|
|
|
90 |
'captype' => 'write',
|
|
|
91 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
92 |
'archetypes' => [
|
|
|
93 |
'editingteacher' => CAP_ALLOW,
|
|
|
94 |
'manager' => CAP_ALLOW
|
|
|
95 |
]
|
|
|
96 |
],
|
|
|
97 |
|
|
|
98 |
// View the quiz overrides (only checked for users who don't have mod/quiz:manageoverrides.
|
|
|
99 |
'mod/quiz:viewoverrides' => [
|
|
|
100 |
'captype' => 'read',
|
|
|
101 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
102 |
'archetypes' => [
|
|
|
103 |
'teacher' => CAP_ALLOW,
|
|
|
104 |
'editingteacher' => CAP_ALLOW,
|
|
|
105 |
'manager' => CAP_ALLOW
|
|
|
106 |
]
|
|
|
107 |
],
|
|
|
108 |
|
|
|
109 |
// Preview the quiz.
|
|
|
110 |
'mod/quiz:preview' => [
|
|
|
111 |
'captype' => 'write', // Only just a write.
|
|
|
112 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
113 |
'archetypes' => [
|
|
|
114 |
'teacher' => CAP_ALLOW,
|
|
|
115 |
'editingteacher' => CAP_ALLOW,
|
|
|
116 |
'manager' => CAP_ALLOW
|
|
|
117 |
]
|
|
|
118 |
],
|
|
|
119 |
|
|
|
120 |
// Manually grade and comment on student attempts at a question.
|
|
|
121 |
'mod/quiz:grade' => [
|
|
|
122 |
'riskbitmask' => RISK_SPAM | RISK_XSS,
|
|
|
123 |
'captype' => 'write',
|
|
|
124 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
125 |
'archetypes' => [
|
|
|
126 |
'teacher' => CAP_ALLOW,
|
|
|
127 |
'editingteacher' => CAP_ALLOW,
|
|
|
128 |
'manager' => CAP_ALLOW
|
|
|
129 |
]
|
|
|
130 |
],
|
|
|
131 |
|
|
|
132 |
// Regrade quizzes.
|
|
|
133 |
'mod/quiz:regrade' => [
|
|
|
134 |
'riskbitmask' => RISK_SPAM,
|
|
|
135 |
'captype' => 'write',
|
|
|
136 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
137 |
'archetypes' => [
|
|
|
138 |
'teacher' => CAP_ALLOW,
|
|
|
139 |
'editingteacher' => CAP_ALLOW,
|
|
|
140 |
'manager' => CAP_ALLOW
|
|
|
141 |
],
|
|
|
142 |
'clonepermissionsfrom' => 'mod/quiz:grade'
|
|
|
143 |
],
|
|
|
144 |
|
|
|
145 |
// View the quiz reports.
|
|
|
146 |
'mod/quiz:viewreports' => [
|
|
|
147 |
'riskbitmask' => RISK_PERSONAL,
|
|
|
148 |
'captype' => 'read',
|
|
|
149 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
150 |
'archetypes' => [
|
|
|
151 |
'teacher' => CAP_ALLOW,
|
|
|
152 |
'editingteacher' => CAP_ALLOW,
|
|
|
153 |
'manager' => CAP_ALLOW
|
|
|
154 |
]
|
|
|
155 |
],
|
|
|
156 |
|
|
|
157 |
// Delete attempts using the overview report.
|
|
|
158 |
'mod/quiz:deleteattempts' => [
|
|
|
159 |
'riskbitmask' => RISK_DATALOSS,
|
|
|
160 |
'captype' => 'write',
|
|
|
161 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
162 |
'archetypes' => [
|
|
|
163 |
'editingteacher' => CAP_ALLOW,
|
|
|
164 |
'manager' => CAP_ALLOW
|
|
|
165 |
]
|
|
|
166 |
],
|
|
|
167 |
|
|
|
168 |
// Re-open attempts after they are closed.
|
|
|
169 |
'mod/quiz:reopenattempts' => [
|
|
|
170 |
'captype' => 'write',
|
|
|
171 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
172 |
'archetypes' => [
|
|
|
173 |
'editingteacher' => CAP_ALLOW,
|
|
|
174 |
'manager' => CAP_ALLOW
|
|
|
175 |
]
|
|
|
176 |
],
|
|
|
177 |
|
|
|
178 |
// Do not have the time limit imposed. Used for accessibility legislation compliance.
|
|
|
179 |
'mod/quiz:ignoretimelimits' => [
|
|
|
180 |
'captype' => 'read',
|
|
|
181 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
182 |
'archetypes' => []
|
|
|
183 |
],
|
|
|
184 |
|
|
|
185 |
// Receive a confirmation message of own quiz submission.
|
|
|
186 |
'mod/quiz:emailconfirmsubmission' => [
|
|
|
187 |
'captype' => 'read',
|
|
|
188 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
189 |
'archetypes' => []
|
|
|
190 |
],
|
|
|
191 |
|
|
|
192 |
// Receive a notification message of other peoples' quiz submissions.
|
|
|
193 |
'mod/quiz:emailnotifysubmission' => [
|
|
|
194 |
'captype' => 'read',
|
|
|
195 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
196 |
'archetypes' => []
|
|
|
197 |
],
|
|
|
198 |
|
|
|
199 |
// Receive a notification message when a quiz attempt becomes overdue.
|
|
|
200 |
'mod/quiz:emailwarnoverdue' => [
|
|
|
201 |
'captype' => 'read',
|
|
|
202 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
203 |
'archetypes' => []
|
|
|
204 |
],
|
|
|
205 |
|
|
|
206 |
// Receive a notification message when a quiz attempt manual graded.
|
|
|
207 |
'mod/quiz:emailnotifyattemptgraded' => [
|
|
|
208 |
'captype' => 'read',
|
|
|
209 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
210 |
'archetypes' => []
|
|
|
211 |
],
|
|
|
212 |
];
|
|
|
213 |
|