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

New Web Service get_course_module_by_instance

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0
    • 2.9.2
    • Web Services
    • MOODLE_29_STABLE
    • MOODLE_30_STABLE
    • MDL-51579-master
    • Hide
      1. Create a course, create any type of activity (forum, chat..)
      2. Enrol a user as student in the course and another user as teacher
      3. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      4. Create a Token for the student and teacher 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, module (module name), instance (the module instance id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'module=forum&instance=2&wsfunction=core_course_get_course_module_by_instance&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      6. Confirm that you receive the basic module information 11 fields, you cannot see information like the visible, and availability info.
      7. As a teacher run the same curl command replacing the token
      8. Confirm that you can see all the module information (22 fields)
      9. Now, as teacher, in the web interface hide the activity
      10. Run the same command and confirm that as a teacher you still receive the information
      11. Run the command now but replacing the token with the student one and confirm that you receive and exception (required login exception)
      Show
      Create a course, create any type of activity (forum, chat..) Enrol a user as student in the course and another user as teacher As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student and teacher 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, module (module name), instance (the module instance id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'module=forum&instance=2&wsfunction=core_course_get_course_module_by_instance&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that you receive the basic module information 11 fields, you cannot see information like the visible, and availability info. As a teacher run the same curl command replacing the token Confirm that you can see all the module information (22 fields) Now, as teacher, in the web interface hide the activity Run the same command and confirm that as a teacher you still receive the information Run the command now but replacing the token with the student one and confirm that you receive and exception (required login exception)

      Return module information passing the module name and instance id

            jleyva Juan Leyva
            jleyva Juan Leyva
            Adrian Greeve Adrian Greeve
            David Monllaó David Monllaó
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.