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

Can edit submission status is not using same conditions between WS and web view

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a course with a teacher and a student and one assignment.
      2. As the student Submit the assignment.-
      3. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      4. Create a Token for the student user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the teacher user.
        • You need to replace the wstoken, assignid (id of the created assign), userid (student id) and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_assign_get_submission_status&assignid=13&userid=6&wstoken=e0962985ad3573791917106a932952f' --compressed

      6. Confirm that the returned json has the field caneditown inside lastattempt object. (Value can differ from canedit).
      Show
      Create a course with a teacher and a student and one assignment. As the student Submit the assignment.- As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user. Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the teacher user. You need to replace the wstoken, assignid (id of the created assign), userid (student id) and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_assign_get_submission_status&assignid=13&userid=6&wstoken=e0962985ad3573791917106a932952f' --compressed Confirm that the returned json has the field caneditown inside lastattempt object. (Value can differ from canedit).
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-56583-master

      Description

      When rendering new assignment grading interface there's a parameter that shows the teacher whether the user can edit its own submission or not. This cause that mobile and website not having the same status.

      For WS the condition involves:

      $showedit = $showlinks &&
                          ($this->is_any_submission_plugin_enabled()) &&
                          $this->can_edit_submission($user->id);
      

      For Web views (including: assign_submission_status and assign_submission_status_compact).

      if ($this->can_view_submission($userid)) {
          $showedit = $this->submissions_open($userid) && ($this->is_any_submission_plugin_enabled());
      }
      

      I think the problem is on WS. can_edit_submission function says: Capability check to make sure this grader can edit this submission. So it's not about the user to edit its own submission.

      It probably needs some backporting.

      Thanks Barbara Ramiro for spotting that! :-D

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pferre22 Pau Ferrer
              Reporter:
              pferre22 Pau Ferrer
              Peer reviewer:
              Dani Palou
              Integrator:
              Andrew Nicols
              Tester:
              Simey Lameze
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                5/Dec/16