Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-48719

New WS function: core_message_get_blocked_users

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.2
    • Fix Version/s: 2.9
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Note: Version number is bumped because a new web service is added into the Mobile app service.

      1. Enable messaging in the site
      2. Create a couple of users accounts, user1 and user2
      3. Log in as user2, send a message from user2 to user1
      4. Log in as user1, go to view your messages. Add user2 as contact, and once added as contact use the icon for "block the user". user2 should be displayed in the list of blocked users.
      5. Enable "Mobile services": Plugins ► Web Services ► External services
      6. Create a Token for the Mobile app service (for user1):
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the userid value with the user1->id .
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache'  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'userid=4&wsfunction=core_message_get_blocked_users&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed
          

      8. Confirm that:
        • The command returns a list of blocked users (in this case, only user2), including id, fullname and the profile image URL
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service. Enable messaging in the site Create a couple of users accounts, user1 and user2 Log in as user2, send a message from user2 to user1 Log in as user1, go to view your messages. Add user2 as contact, and once added as contact use the icon for "block the user". user2 should be displayed in the list of blocked users. Enable "Mobile services": Plugins ► Web Services ► External services Create a Token for the Mobile app service (for user1): Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client: You need to replace the userid value with the user1->id . You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'userid=4&wsfunction=core_message_get_blocked_users&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed Confirm that: The command returns a list of blocked users (in this case, only user2), including id, fullname and the profile image URL
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48719-master

      Description

      This function will return a list of blocked users for the user specified as a parameter.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

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