Question permissions explained with diagrams
Note: You are currently viewing documentation for Moodle 2.4. Up-to-date documentation for the latest stable version of Moodle may be available here: Question permissions explained with diagrams.
A simple story
1. Setting the scene
For this explanation, we will imagine we have this very simple Moodle site. There are three courses, all in the Miscellaneous category. The courses have a few activities in them.
2. Introducing Fred
We will focus on a particular user: Fred. Fred is a teacher in two of the courses. In Moodle, everyone gets some permissions throughout the whole Moodle site because they are logged in. Additionally, Fred gets more permissions in the courses he teaches, and all the activities in those courses, because he has the teacher role there.
3. Using questions in a course
Fred creates some questions in his maths course and adds them to the quiz. Why does this work?
By default, questions are created in the question bank in a category that belongs to that course. Fred is a teacher in the course. Teachers are allowed to create questions. Therefore Fred can create the questions, and they get stored linked to the course.
The quiz is in the course. Fred is a teacher in the course, so Fred has permission to add questions to the quiz. The quiz is in the course, so the course questions are potentially available. Fred is a teacher in the course, so he is allowed use the questions in the course question bank. Therefore Fred can add the questions to his quiz.
Fred now wants to reuse some of his questions in his biology course. However, the biology quiz is not in the maths course, so the questions are not available.
So Fred's friendly Moodle administrator Annie moves the questions into the part of the question bank associated with the category Miscellaneous. Disaster! now Fred can't see his questions at all. Why not?
Now the questions are outside the course. Fred has no extra permissions outside the course, so he cannot access the questions there.
5. Successfully sharing questions
Annie creates a new role 'Question user' that allows all the permissions needed to access the question bank. Annie assigns Fred that role in the whole system. Now Fred can see his questions from within both courses, edit them, and add them to his quizzes. Why?
The questions are linked to category Miscellaneous. Miscellaneous is inside the system. Fred is a Question user in the system. Question users can access the question bank. So Fred can access this part of the question bank.
The quizzes are in courses where Fred is a teacher, so Fred is has permission to add questions to the quizzes. The quizzes are in the Miscellaneous category, so the questions in that part of the question bank are potentially available. We have just seen that Fred has permission to access these question. Therefore Fred can add these questions to his quizzes.
Summary of the rules
Questions are stored in the question bank linked to some part of your Moodle system (technically a context). The part of the system might be (and most often is) a course, or a course category, the whole system, or an individual activity.
To create and editing questions
you must have the appropriate capability in the part of the system where the questions are stored, to have permission to do the corresponding operation (add, edit, ...).
To add questions to a quiz
three checks have to pass:
- You must have the mod/quiz:manage capability in that quiz, to have permission to add questions to it.
- The quiz must be inside the part of the system where the questions are stored, in order for the questions to be available in the quiz.
- You must have the moodle/question:use(all/mine) capability in the part of the system where the questions are stored, to have permission to use those questions.