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

New Web Service mod_lesson_get_lesson_access_information

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for one student in a course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Now create a lesson activity configured in a way that is not yet open (timeavailable), add a couple of pages to the lesson.
      4. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, lessonid (lesson instance id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=6&wsfunction=mod_lesson_get_lesson_access_information&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      5. Check that you receive a preventaccessreasons "lessonopen" informing you that the lesson is not yet available
      6. Check that all of the can* fields are false
      7. Check that the firstpageid match with your lesson first page id in the database (lesson_pages table)
      8. Check that last page seen is equal to 0
      9. Check that attempts/retries is equal to 0
      10. Now, as admin or teacher, remove the time restriction
      11. As student access the lesson, open at least the first page
      12. Execute the Web Service request again and check that lastpageseen has been updated
      13. Check that preventaccessreasons is now empty
      14. Now, generate a token for an editing teacher in the course where the lesson is
      15. Execute the WS using the teacher token and check that you see correctly canmanage set to true and that the capabilities are all set to true
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one student in a course: Click on Site administration ► Plugins ► Web services ► Manage tokens Now create a lesson activity configured in a way that is not yet open (timeavailable), add a couple of pages to the lesson. Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, lessonid (lesson instance id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=6&wsfunction=mod_lesson_get_lesson_access_information&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Check that you receive a preventaccessreasons "lessonopen" informing you that the lesson is not yet available Check that all of the can* fields are false Check that the firstpageid match with your lesson first page id in the database (lesson_pages table) Check that last page seen is equal to 0 Check that attempts/retries is equal to 0 Now, as admin or teacher, remove the time restriction As student access the lesson, open at least the first page Execute the Web Service request again and check that lastpageseen has been updated Check that preventaccessreasons is now empty Now, generate a token for an editing teacher in the course where the lesson is Execute the WS using the teacher token and check that you see correctly canmanage set to true and that the capabilities are all set to true
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57643-master

      Description

      Return access information for the current user in a given course.

      This WS check if the user can attempt the lesson and return capabilities and other information summarizing the current status of the user in the lesson.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                cameron1729
                Integrator:
                Andrew Nicols
                Tester:
                Andrew Nicols
                Participants:
                Component watchers:
                Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, 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:
                  15/May/17