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

New Web Service core_course_get_course_module

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0
    • 2.9.1, 3.0
    • Web Services
    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_30_STABLE
    • MDL-51371-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, cmid (with the activity course module id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'cmid=81&wsfunction=core_course_get_course_module&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, cmid (with the activity course module id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'cmid=81&wsfunction=core_course_get_course_module&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)

      core_course_get_course_module

      Returns information about a course module (the user needs to have permission to view the module)

      parameters: cmid - Course module id
      returns: Module information (the information returned by get_coursemodule_from_id) including the section number

      Note: Some private/sensitive information won't be returned if the user does not have the manageactivities capability at module level

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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