Quiz Review, Quiz Restrictions not honored

Quiz Review, Quiz Restrictions not honored

by jason everling -
Number of replies: 11

Version: 2.9 - When setting up quiz restrictions such as IP Address, those settings are not honored when reviewing the quiz. The open/close times are but not the IP Address restrictions. How can this be changed? Is there a little code that can be modified to check for ip address during a review?

Average of ratings: -
In reply to jason everling

Re: Quiz Review, Quiz Restrictions not honored

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It can't be changed (without altering the code). That is how it is designed to work.

(Whether this is the best way it could work is something that has been discussed in the past, without any firm conclusions being reached.)

In reply to Tim Hunt

Re: Quiz Review, Quiz Restrictions not honored

by jason everling -

That really stinks! We will be probably end up losing this feature for one department because as soon as a quiz is over they will go to another device in another room or hallway and screenshot/copy/paste the entire quiz. This just happened and is how I noticed it.

What areas need to be changed?

In reply to jason everling

Re: Quiz Review, Quiz Restrictions not honored

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

"That really stinks!"

That may not be the most effective way of procuring support.

In reply to Marcus Green

Re: Quiz Review, Quiz Restrictions not honored

by jason everling -

Hah! That was just my initial reaction,  I was really hoping it was a bug. If there is an access rule for any module in Moodle it should be honored no matter what, at least, that's what I believe.

In reply to jason everling

Re: Quiz Review, Quiz Restrictions not honored

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

This may be the type of thing to report as an issue in the bug tracker. That is not to suggest it might be fixed, just that any unexpected behaviour is good to have documented.

One of the very nice things about Moodle is that there is heaps of automated tests. This is not of direct and obvious benefit to end users but it does mean that stuff is effectively documented, even if it documents a test failing.  I write as a man recently seduced by the glory of Behat and Mink testing whereby a ghost in the browser does all the clicking for you and never gets bored of doing it.

In reply to jason everling

Re: Quiz Review, Quiz Restrictions not honored

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you look near the top of attempt.php (https://github.com/moodle/moodle/blob/master/mod/quiz/attempt.php#L81) you will see that it basically involves calling the prevent_access method of $accessmanager. If any messages are returned, display them as an error, rather than continuing to display the page.

You would need to add similar code at the top of review.php. just after this bit might be a good place: https://github.com/moodle/moodle/blob/master/mod/quiz/review.php#L58

Well, to do a better job, you would also need to find every place where it prints a link to the review page, and stop showing those links, because generally speaking it is bad usability to show someone a link that just takes them to an 'access denied' error. However, that is a refinement that you could add later after getting the important bit of blocking access to work.

In reply to Tim Hunt

Re: Quiz Review, Quiz Restrictions not honored

by jason everling -

Thanks! I will take this and work it out, even if they get an access denied error it will be better than them being able to view all the answers/questions in an unmonitored environment.

In reply to Tim Hunt

Re: Quiz Review, Quiz Restrictions not honored

by jason everling -

Thanks again! I managed to get working, they can no longer review the quiz when not on the specified subnet. I also created a new language string which displays a better message than an error page.

Could this be added to core? Should there be an option to restrict review access based on the access rules instead of all or none? I am also working on removing the "review" links throughout. Teachers would still be able to review though on any subnet.


In reply to jason everling

Re: Quiz Review, Quiz Restrictions not honored

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

We discussed adding this to core once before. You are not the first person to ask for this. However, the number of people who want it is quite small. So, it is a trade-off between add yet another option to the already complex quiz form for everyone, in order to satisfy a few people.

Oh, I just had a worrying thought. Does this make it impossible to review a quiz that has a time limit or a close date?

If we do implement this in core, probably the best way is a new option in the Extra restrictions on attempts section: Restrictions apply to reviews as well as attempts: Yes/No.

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Quiz Review, Quiz Restrictions not honored

by jason everling -

That would make sense, not enough users have requested it. I have not yet tested it yet though for after the quiz is closed or time limit, in our case though, we do not allow review once it is closed. If we do encounter that issue, then I will more than likely have to make more changes so that it only checks the ipaddress access rule.

That is what I was thinking, adding a check box to the extra restrictions page, I will probably end up doing it for ours, then apply the patch after each update.

Thanks!

In reply to jason everling

Tárgy: Re: Quiz Review, Quiz Restrictions not honored

by Csaba Vágvölgyi -

Hi!

We got version Moodle 3.09.

Can you help me to how to modify the code if I want the same restrictions to the quiz review? (the most important is IP restriction)

Thanks is advance,
Csaba