XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.8
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide

      Notice that I've bumped the version number. A new webservice is added and the Mobile service modified.

      Use this client: https://gist.github.com/jleyva/c83f2d042bdd744815bf
      The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php

      Note: Need to enable enablemobilewebservice

      You should test using not-admin accounts because some of the expected results differs depending on your site capabilities.

      You need a token for the Mobile Service:
      Create Token:
      Click on Site administration ► Plugins ► Web services ► Manage tokens
      Click add, select user and service (Mobile Service)

      1 Enable messaging in your Moodle installation
      2 Send a private message to the user you created the token for
      3 Edit the php client, add your Moodle installation url, and user token.
      4 Edit the ws parameters, useridto = the user id you used for the token creation, useridfrom = 0
      5 Call the the ws client in a browser, you should get a list of the messages you received from any user in the system, if you don't receive the list change the read value from 0 to 1 (maybe you have read the messages yet) You may use this online tool http://jsonlint.com/ for formatting the output
      6 Change useridfrom from 0 to a valid user id you used for sending a message to useridto
      7 Run the ws client again, you should get a list of messages send by useidfrom to useridto
      8 Change the limit and newest values, so you can limit the number of messages to retrieve and also the order direction (check that is working in both cases)
      9 Change type from both to conversations, you should get the same list of messages
      10 Change type to notifications, you should get an empty list of messages
      11 Changeuseridto or usedidfrom to an inexistent user id, you should get an invalid user error
      11 Change useridto and useridfrom to 0, you should get accessdenied error (if the testing user is admin, you should see an empt list of messages and warnings)
      12 Change useridto to a valid user id (different that the one used to get the token) and useridfrom to 0. you should get and accessdenied error (if the testing user is admin, you should see a empty list of messages and warnings)

      Show
      Notice that I've bumped the version number. A new webservice is added and the Mobile service modified. Use this client: https://gist.github.com/jleyva/c83f2d042bdd744815bf The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php Note: Need to enable enablemobilewebservice You should test using not-admin accounts because some of the expected results differs depending on your site capabilities. You need a token for the Mobile Service: Create Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) 1 Enable messaging in your Moodle installation 2 Send a private message to the user you created the token for 3 Edit the php client, add your Moodle installation url, and user token. 4 Edit the ws parameters, useridto = the user id you used for the token creation, useridfrom = 0 5 Call the the ws client in a browser, you should get a list of the messages you received from any user in the system, if you don't receive the list change the read value from 0 to 1 (maybe you have read the messages yet) You may use this online tool http://jsonlint.com/ for formatting the output 6 Change useridfrom from 0 to a valid user id you used for sending a message to useridto 7 Run the ws client again, you should get a list of messages send by useidfrom to useridto 8 Change the limit and newest values, so you can limit the number of messages to retrieve and also the order direction (check that is working in both cases) 9 Change type from both to conversations, you should get the same list of messages 10 Change type to notifications, you should get an empty list of messages 11 Changeuseridto or usedidfrom to an inexistent user id, you should get an invalid user error 11 Change useridto and useridfrom to 0, you should get accessdenied error (if the testing user is admin, you should see an empt list of messages and warnings) 12 Change useridto to a valid user id (different that the one used to get the token) and useridfrom to 0. you should get and accessdenied error (if the testing user is admin, you should see a empty list of messages and warnings)
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      core_message_get_messages: Function for retrieving user's conversations or notifications (both received/send messages)

      It seems that the current message external functions seems to work only for the current user accessing the service (get_contacts doesn't has any input parameter)

      It doesn't feel correct to me since the current message API support the "moodle/site:readallmessages" capability, so you can read other user's conversations. Also, functions like get_contacts supports the user parameter.

      So my plan is to implement this new external function with the following parameters:

      $userid - The user we want to get the notifications
      $userfrom = If we want to filter from users
      $type = conversations, notifications or both
      $read = true or false, retrieve only messages read or not read (Not both, limitfrom and limitnum will not work with both)
      $newestfirst - sort order
      $limitfrom - Return a subset of records, starting at this one
      $limitnum - Number of records to return

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14