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

Forum/Rating Web Services seems to not handle correctly data when users are deleted

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.5
    • 2.8.6
    • Web Services
    • MOODLE_28_STABLE
    • MOODLE_28_STABLE
    • MDL-49763-master
    • Hide
      1. Create a course with a forum, enrol a couple of students.
      2. Post in the forum using the two students accounts
      3. Delete one of the students accounts
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. You need to create a token for the student you didn't delete for the Mobile Service, for creating a Token:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
        • Click add, select user and service (Mobile Service)
      6. Execute the following command in a console, you have to change:
        • wstoken: With the token you created
        • forumid: With the forum instance id (id of the forum in the forum table)

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'forumid=8&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed

      7. Confirm that you receive all the messages, including the ones with the user deleted, the users deletes have an empty profile image URL
      • Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output
      Show
      Create a course with a forum, enrol a couple of students. Post in the forum using the two students accounts Delete one of the students accounts Enable "Mobile services": Plugins ► Web Services ► Mobile You need to create a token for the student you didn't delete for the Mobile Service, for creating a Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Execute the following command in a console, you have to change: wstoken: With the token you created forumid: With the forum instance id (id of the forum in the forum table) curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'forumid=8&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed Confirm that you receive all the messages, including the ones with the user deleted, the users deletes have an empty profile image URL Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

    Description

      It seems that in some cases if a user that participated in a course (posted in forum) is deleted, the external functions (web services response) is not correctly processed returning errors.

      Steps to reproduce

      1. Post in a forum with a student user
      2. Delete the user
        # The messages from the deleted users are still there
      3. Using the mobile app try to read the messages of the forum, you get an "Invalid user" exception

      Attachments

        Activity

          People

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Dan Poltawski Dan Poltawski
            Jetha Chan Jetha Chan
            Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/May/15