I'm currently developping a plugin to autommatically create a quiz in moodle from API calls. Nothing hard there, I'm creating a course where I enrol my students and a quiz corresponding to an exam from my platform (outside of moodle).
Thing is : I want to restrict the access to the quiz only to people registered to the exam outside (so people not registered in my platform can't connect into moodle and access the quiz). Without code, I would create a group inside the course, add in this group all the people registered to the exam, and restrict the access of the quiz to the group.
Problem is : I don't want to do it manually every time my platform automatically creates an exam on moodle, for 2 reasons :
1. There can be more than 30 exams created per week
2. It's not really efficient on the long run
Quesion : even if I had no problem on the implementation for the quiz / group part, I can't find a way / file / lib.php / whatever that allows me to programmatically allows me to restrict a quiz access. Any suggestions ?