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

New Web Service mod_lesson_get_lessons_by_courses

XMLWordPrintable

    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-57633-master
    • Hide
      1. Create four lesson activities. One with the default settings, another one with the default settings but not visible, another one password protected, another one with a time restriction (lesson that starts in a month for example)
      2. Enable "Mobile services": Plugins ► Web Services ► Mobile
      3. Create a Token for one teacher and one student enrolled in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user .
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=17&wsfunction=mod_lesson_get_lessons_by_courses&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

      5. Confirm that
        • As student you don't see the non-visible lesson but you see the other three; the password protected and the one with the time restrictions will return only the basic information like id, course module, course and name
        • As a teacher you see all the lessons including extra information like the password field
      Show
      Create four lesson activities. One with the default settings, another one with the default settings but not visible, another one password protected, another one with a time restriction (lesson that starts in a month for example) Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one teacher and one student enrolled in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user . You need to replace the wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=17&wsfunction=mod_lesson_get_lessons_by_courses&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output Confirm that As student you don't see the non-visible lesson but you see the other three; the password protected and the one with the time restrictions will return only the basic information like id, course module, course and name As a teacher you see all the lessons including extra information like the password field

      Return a list of lessons available for the current user in the given course.

      This Ws should return only the lesson configuration fields available according the user permissions in the course.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Adrian Greeve Adrian Greeve
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Simey Lameze Simey Lameze
            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.