Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-79274

Assignment conversion to PDF fails when the submitting assignment user is unenrolled from the course

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-79274_master
    • Hide

      Set up the site :

      1. Install gs:
        apt-get update && apt-get install ghostscript
      2. Create a course.
      3. Create 2 students: Student One, Student Two
      4. Enrol students to the course with Student role.
      5. Crate Assignment activity with Submission types set to File submissions and Annotate PDF enabled in Feedback types.
      6. Log in as Student One and submit a submission with an image.
      7. Log in as Student Two and submit a submission with an image.
      8. Confirm, that ad-hoc tasks were created for each student  submissions:
        SELECT * FROM mdl_task_adhoc;
      9. Unenrol student one from the course.
      10. Run ad-hoc tasks runner.
        php admin/cli/adhoc_task.php --execute
      11. Confirm that the document conversion task fails with a permission error.
      12. Apply the patch
      13. Rerun the adhoc tasks runner
        php admin/cli/adhoc_task.php --execute
      14. Confirm that no errors are present and all document conversion adhoc tasks complete.
      Show
      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 the document conversion task fails with a permission error. Apply the patch Rerun the adhoc tasks runner php admin/cli/adhoc_task.php --execute Confirm that no errors are present and all document conversion adhoc tasks complete.

      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 :

      1. Install gs:
        apt-get update && apt-get install ghostscript
      2. Create a course.
      3. Create 2 students: Student One, Student Two
      4. Enrol students to the course with Student role.
      5. Crate Assignment activity with Submission types set to File submissions and Annotate PDF enabled in Feedback types.
      6. Log in as Student One and submit a submission with an image.
      7. Log in as Student Two and submit a submission with an image.
      8. Confirm, that ad-hoc tasks were created for each student  submissions:
        SELECT * FROM mdl_task_adhoc;
      9. Unenrol student one from the course.
      10. Run ad-hoc tasks runner.
        php admin/cli/adhoc_task.php --execute
      11. Confirm that one of the task's fails with a permission error.

            devinefran Francis Devine
            devinefran Francis Devine
            Dan Marsden Dan Marsden
            Huong Nguyen Huong Nguyen
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 37 minutes
                1h 37m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.