2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * Capability definitions for the quiz module.
21 * @copyright 2006 The Open University
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') ||
die();
29 // Ability to see that the quiz exists, and the basic information
30 // about it, for example the start date and time limit.
33 'contextlevel' => CONTEXT_MODULE
,
36 'student' => CAP_ALLOW
,
37 'teacher' => CAP_ALLOW
,
38 'editingteacher' => CAP_ALLOW
,
39 'manager' => CAP_ALLOW
43 // Ability to add a new quiz to the course.
44 'mod/quiz:addinstance' => [
45 'riskbitmask' => RISK_XSS
,
48 'contextlevel' => CONTEXT_COURSE
,
50 'editingteacher' => CAP_ALLOW
,
51 'manager' => CAP_ALLOW
53 'clonepermissionsfrom' => 'moodle/course:manageactivities'
56 // Ability to do the quiz as a 'student'.
57 'mod/quiz:attempt' => [
58 'riskbitmask' => RISK_SPAM
,
60 'contextlevel' => CONTEXT_MODULE
,
62 'student' => CAP_ALLOW
66 // Ability for a 'Student' to review their previous attempts. Review by
67 // 'Teachers' is controlled by mod/quiz:viewreports.
68 'mod/quiz:reviewmyattempts' => [
70 'contextlevel' => CONTEXT_MODULE
,
72 'student' => CAP_ALLOW
74 'clonepermissionsfrom' => 'moodle/quiz:attempt'
77 // Edit the quiz settings, add and remove questions.
78 'mod/quiz:manage' => [
79 'riskbitmask' => RISK_SPAM
,
81 'contextlevel' => CONTEXT_MODULE
,
83 'editingteacher' => CAP_ALLOW
,
84 'manager' => CAP_ALLOW
88 // Edit the quiz overrides.
89 'mod/quiz:manageoverrides' => [
91 'contextlevel' => CONTEXT_MODULE
,
93 'editingteacher' => CAP_ALLOW
,
94 'manager' => CAP_ALLOW
98 // View the quiz overrides (only checked for users who don't have mod/quiz:manageoverrides.
99 'mod/quiz:viewoverrides' => [
101 'contextlevel' => CONTEXT_MODULE
,
103 'teacher' => CAP_ALLOW
,
104 'editingteacher' => CAP_ALLOW
,
105 'manager' => CAP_ALLOW
110 'mod/quiz:preview' => [
111 'captype' => 'write', // Only just a write.
112 'contextlevel' => CONTEXT_MODULE
,
114 'teacher' => CAP_ALLOW
,
115 'editingteacher' => CAP_ALLOW
,
116 'manager' => CAP_ALLOW
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
,
126 'teacher' => CAP_ALLOW
,
127 'editingteacher' => CAP_ALLOW
,
128 'manager' => CAP_ALLOW
133 'mod/quiz:regrade' => [
134 'riskbitmask' => RISK_SPAM
,
135 'captype' => 'write',
136 'contextlevel' => CONTEXT_MODULE
,
138 'teacher' => CAP_ALLOW
,
139 'editingteacher' => CAP_ALLOW
,
140 'manager' => CAP_ALLOW
142 'clonepermissionsfrom' => 'mod/quiz:grade'
145 // View the quiz reports.
146 'mod/quiz:viewreports' => [
147 'riskbitmask' => RISK_PERSONAL
,
149 'contextlevel' => CONTEXT_MODULE
,
151 'teacher' => CAP_ALLOW
,
152 'editingteacher' => CAP_ALLOW
,
153 'manager' => CAP_ALLOW
157 // Delete attempts using the overview report.
158 'mod/quiz:deleteattempts' => [
159 'riskbitmask' => RISK_DATALOSS
,
160 'captype' => 'write',
161 'contextlevel' => CONTEXT_MODULE
,
163 'editingteacher' => CAP_ALLOW
,
164 'manager' => CAP_ALLOW
168 // Re-open attempts after they are closed.
169 'mod/quiz:reopenattempts' => [
170 'captype' => 'write',
171 'contextlevel' => CONTEXT_MODULE
,
173 'editingteacher' => CAP_ALLOW
,
174 'manager' => CAP_ALLOW
178 // Do not have the time limit imposed. Used for accessibility legislation compliance.
179 'mod/quiz:ignoretimelimits' => [
181 'contextlevel' => CONTEXT_MODULE
,
185 // Receive a confirmation message of own quiz submission.
186 'mod/quiz:emailconfirmsubmission' => [
188 'contextlevel' => CONTEXT_MODULE
,
192 // Receive a notification message of other peoples' quiz submissions.
193 'mod/quiz:emailnotifysubmission' => [
195 'contextlevel' => CONTEXT_MODULE
,
199 // Receive a notification message when a quiz attempt becomes overdue.
200 'mod/quiz:emailwarnoverdue' => [
202 'contextlevel' => CONTEXT_MODULE
,
206 // Receive a notification message when a quiz attempt manual graded.
207 'mod/quiz:emailnotifyattemptgraded' => [
209 'contextlevel' => CONTEXT_MODULE
,