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

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.5
    • Fix Version/s: 2.8.6
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49763-master

      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

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/15