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

Admin cannot view assignment submission file/image/comments when team submissions is enabled

    Details

    • Testing Instructions:
      Hide
      1. Create an assignment and enable team submissions with online text.
      2. As a student make a submission to the assignment and include an image in the online text (via the TinyMCE editor).
      3. View the submission as an admin.

      Expected results:

      • Admin can view the image submitted as part of the online submission.
      Show
      Create an assignment and enable team submissions with online text. As a student make a submission to the assignment and include an image in the online text (via the TinyMCE editor). View the submission as an admin. Expected results: Admin can view the image submitted as part of the online submission.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      When an assignment has team submissions enabled, the admin user can not view images in submitted as part of online text or download a file submitted.

      Reproduction steps:

      1. Create an assignment and enable team submissions with online text.
      2. As a student make a submission to the assignment and include an image in the online text (via the TinyMCE editor).
      3. View the submission as an admin.

      Expected results:

      • Admin can view the image submitted as part of the online submission.

      Actual results:

      • Admin can not view the image submitted as part of the online submission.

      This can also be reproduced using file submissions, which is how I originally found the issue. And while I haven't tested it is likely to affect submission comments as well because it uses the method where the issue is found.

      I believe the issue caused by the is_enrolled() check made in the assign class can_view_group_submission() method. The is_enrolled() call returns false for the admin, which in turn causes can_view_group_submission() to return false as well. can_view_group_submission() is used by assignsubmission_onlinetext_pluginfile() and assignsubmission_file_pluginfile().

      Possible solutions:

      • Move the has_capability() check for 'mod/assign:grade' above the is_enrolled() check.
      • Add a check for admins in the conditional with is_enrolled() (e.g. if (!$isadmin && !is_enrolled())

      If either of these sound good (or if even you'd like to go another route), I'd be glad to supply a patch or pull request. Just let me know.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13