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

New Web Service get_course_module_by_instance

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.2
    • Fix Version/s: 3.0
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      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)
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-51579-master

      Description

      Return module information passing the module name and instance id

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Adrian Greeve
              Integrator:
              David Monllaó
              Tester:
              Rajesh Taneja
              Participants:
              Component watchers:
              Juan Leyva, Jake Dallimore, Jun Pataleta
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                16/Nov/15