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

New Web Service enrol_guest_get_instance_info

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a new course (with no users)
      3. Add one instance of the guest-enrolment method (enabled without password)
      4. Create a Token for one authenticated 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 student user.
        • You need to replace the wstoken, and the URL of your moodle instance. Replace also the courseid with the not visible course id.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data ‘courseid=106&wsfunction=core_enrol_get_course_enrolment_methods&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      6. Confirm that you see listed the guest-enrolment method.
      7. Now, execute the following CURL request replacing the instanceid with the guest-enrolment plugin instance id for the course in the database.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data ‘instanceid=106&wsfunction=enrol_guest_get_instance_info&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      8. Confirm that in the CURL response you see the correct values for id, courseid, type, name, status and passwordrequired
      9. Now, edit the guest-enrolment settings add a password and change the status value
      10. Execute the CURL command again and confirm that you see the correct values for passwordrequired and status
      Show
      As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a new course (with no users) Add one instance of the guest-enrolment method (enabled without password) Create a Token for one authenticated user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, and the URL of your moodle instance. Replace also the courseid with the not visible course id. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data ‘courseid=106&wsfunction=core_enrol_get_course_enrolment_methods&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that you see listed the guest-enrolment method. Now, execute the following CURL request replacing the instanceid with the guest-enrolment plugin instance id for the course in the database. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data ‘instanceid=106&wsfunction=enrol_guest_get_instance_info&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that in the CURL response you see the correct values for id, courseid, type, name, status and passwordrequired Now, edit the guest-enrolment settings add a password and change the status value Execute the CURL command again and confirm that you see the correct values for passwordrequired and status
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-52073-master

      Description

      Return public information about the guest enrolment method settings.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16