-
Bug
-
Resolution: Fixed
-
Minor
-
4.1.5
-
MOODLE_401_STABLE
-
MOODLE_401_STABLE, MOODLE_402_STABLE
-
MDL-79274_master -
If a user is unenrolled from a course before the adhoc convert_submission task can be run, it will fail with an exception "You don't have permission to access this page"
example trace
Adhoc task failed: assignfeedback_editpdf\task\convert_submission,You don't have permission to access this page. Backtrace: * line 336 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::get_combined_document_for_attempt() * line 84 of /mod/assign/feedback/editpdf/classes/task/convert_submission.php: call to assignfeedback_editpdf\document_services::get_combined_pdf_for_attempt() * line 367 of /lib/cronlib.php: call to assignfeedback_editpdf\task\convert_submission->execute() * line 198 of /lib/cronlib.php: call to cron_run_inner_adhoc_task() * line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks() * line 178 of /admin/cli/cron.php: call to cron_run() |
This appears to be a regression of MDL-56810
caused by either MDL-75247 or MDL-71468
From the comments of MDL-56810 it seems that Daymon Weise said the correct behaviour is that the task should not attempt conversion.
>The present behaviour is correct, if the user is not enrolled the submission should not be converted. This matches the behaviour of other parts of assignment module, if the user is not enrolled it won't be displayed in other areas.
Which would imply the actual correct fix is to check if the user is still enrolled in the course before attempting adhoc document conversion, and if they are not, to complete the task without attempting conversion.
Testing steps
Set up the site :
- Install gs:
apt-get update && apt-get install ghostscript - Create a course.
- Create 2 students: Student One, Student Two
- Enrol students to the course with Student role.
- Crate Assignment activity with Submission types set to File submissions and Annotate PDF enabled in Feedback types.
- Log in as Student One and submit a submission with an image.
- Log in as Student Two and submit a submission with an image.
- Confirm, that ad-hoc tasks were created for each student submissions:
SELECT * FROM mdl_task_adhoc; - Unenrol student one from the course.
- Run ad-hoc tasks runner.
php admin/cli/adhoc_task.php --execute - Confirm that one of the task's fails with a permission error.