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

    • MOODLE_32_STABLE
    • MOODLE_32_STABLE
    • MDL-56583-master
    • 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).

      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 barbararamiro for spotting that! :-D

            pferre22 Pau Ferrer
            pferre22 Pau Ferrer
            Dani Palou Dani Palou
            Andrew Lyons Andrew Lyons
            Simey Lameze Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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