Moodle
  1. Moodle
  2. MDL-37710

Students cannot access their own submitted files in a teamsubmission assignment

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.1
    • Fix Version/s: 2.4.2
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      Hide
      1. Create an assignment with these settings:
        1. "Students submit in groups" = "Yes"
        2. "File submissions" = "Yes"
        3. "Online text" = "Yes"
        4. "Submission comments" = "Yes"
      2. Login as a student and submit to the assignment. Make sure the submission includes:
        1. a file
        2. an image in the online text
      3. Verify you can download the file and see the image from the summary page of the assignment as a student.
      4. Add a comment to the submission and verify that it saves correctly.
      5. Login as a teacher and verify you can see the file and image and comments in the submission from the student.
      Show
      Create an assignment with these settings: "Students submit in groups" = "Yes" "File submissions" = "Yes" "Online text" = "Yes" "Submission comments" = "Yes" Login as a student and submit to the assignment. Make sure the submission includes: a file an image in the online text Verify you can download the file and see the image from the summary page of the assignment as a student. Add a comment to the submission and verify that it saves correctly. Login as a teacher and verify you can see the file and image and comments in the submission from the student.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-37710-master

      Description

      Assignment allows submission in team mode: one student submit a file and the file "counts" for all members of the group that worked as a team.

      Assignment correctly show the file link in the summary table for students and teachers. Teachers can click and get the submitted file without trouble. However, if the students try to access the submitted file they get an error message. Even the student that originally submitted the file.
      So, if one member of a team uploads a file, the other members cannot see the content. The students cannot verify that the uploaded file is the right one before clicking confirmation (if activated).

      The problem lies in teamsubmissions being stored in DB with userid=0. When assignsubmission_file_pluginfile() checks for permissions to see the submission associated file tries to test user with userid=0, that obviously do not exists.

      assignsubmission_file_pluginfile() must get groupid fron submission data, in addition to userid, and must check specifically for teamsumission and the check if current $USER asking to get the file is a member of the group indicated in the submission data.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Enrique Castro added a comment -

            At ULPGC we have added in assign/submission/file/lib.php

            $record = $DB->get_record('assign_submission', array('id'=>$itemid), 'userid, assignment, groupid', MUST_EXIST);
            $userid = $record->userid;
            $groupid = $record->groupid;

            and then

            // check is users submission or has grading permission
            $cangrade = has_capability('mod/assign:grade', $context);
            if($assign->teamsubmission && $cm->groupmode) {
            if(!$cangrade && !groups_is_member($groupid, $USER->id))

            { return false; }

            } elseif (!$cangrade && $USER->id != $userid)

            { return false; }
            Show
            Enrique Castro added a comment - At ULPGC we have added in assign/submission/file/lib.php $record = $DB->get_record('assign_submission', array('id'=>$itemid), 'userid, assignment, groupid', MUST_EXIST); $userid = $record->userid; $groupid = $record->groupid; and then // check is users submission or has grading permission $cangrade = has_capability('mod/assign:grade', $context); if($assign->teamsubmission && $cm->groupmode) { if(!$cangrade && !groups_is_member($groupid, $USER->id)) { return false; } } elseif (!$cangrade && $USER->id != $userid) { return false; }
            Hide
            Damyon Wiese added a comment -

            Thanks for reporting this - I've raised the priority and will review it ASAP.

            Show
            Damyon Wiese added a comment - Thanks for reporting this - I've raised the priority and will review it ASAP.
            Hide
            Damyon Wiese added a comment -

            Thanks Enrique - there were some issues with your patch - I've created a new one to fix this issue. (Your patch only fixes submission files - not images in online text. It also does not account for the "default" group).

            Show
            Damyon Wiese added a comment - Thanks Enrique - there were some issues with your patch - I've created a new one to fix this issue. (Your patch only fixes submission files - not images in online text. It also does not account for the "default" group).
            Hide
            Damyon Wiese added a comment -

            Note for integrators - in fixing this I decided the best way to prevent future regressions was to take the performance hit and include locallib.php and have all these plugins call the same functions to do their access checks - this will keep them all in sync in the future.

            Show
            Damyon Wiese added a comment - Note for integrators - in fixing this I decided the best way to prevent future regressions was to take the performance hit and include locallib.php and have all these plugins call the same functions to do their access checks - this will keep them all in sync in the future.
            Hide
            Damyon Wiese added a comment -

            2.4 and master only.

            Show
            Damyon Wiese added a comment - 2.4 and master only.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            Dan Poltawski added a comment -

            Integrated to master and 24. Thanks Damyon

            Show
            Dan Poltawski added a comment - Integrated to master and 24. Thanks Damyon
            Hide
            Andrew Davis added a comment -

            Works as described. Passing.

            Show
            Andrew Davis added a comment - Works as described. Passing.
            Hide
            Damyon Wiese added a comment -

            Congratulations! This issue has been resolved. Thanks for helping to make Moodle better for everyone!

            Regards, Damyon

            Show
            Damyon Wiese added a comment - Congratulations! This issue has been resolved. Thanks for helping to make Moodle better for everyone! Regards, Damyon

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: