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

core_calendar_get_calendar_events filters category events for students

XMLWordPrintable

    • MOODLE_34_STABLE
    • MOODLE_34_STABLE
    • MDL-60813-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create the following categories:
        • Top: Cat1 (Top means at top level)
        • Cat1 / SubCat1.1
        • Top: Cat2
      3. As admin create a category calendar event in Cat1, Cat2 and in SubCat1.1
      4. Create one course under SubCat1.1 category and enrole one user as student.
      5. Create a Token in the mobile app service for the user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, courseid with the course created one and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'options[userevents]=0&options[siteevents]=0&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_calendar_get_calendar_events&wstoken=12a2a65aeea2a177055e233f9e303218&events[courseids][0]=23' --compressed | python -m "json.tool"

      7. Check that you receive the category events created for Cat1 and SubCat1.1
      8. Now, execute the following WS request replacing the categoryid with the SubCat1.1 category id

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'options[userevents]=0&options[siteevents]=0&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_calendar_get_calendar_events&wstoken=12a2a65aeea2a177055e233f9e303218&events[categoryids][0]=23' --compressed | python -m "json.tool"

      9. Check that you receive the category events created for Cat1 and SubCat1.1
      10. Execute the same WS request but using as category id the Cat1 one
      11. Check that you receive only the category event created for Cat1
      12. Execute the same WS request but using as category id the Cat2 one
      13. Check that you don't receive any category event
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create the following categories: Top: Cat1 (Top means at top level) Cat1 / SubCat1.1 Top: Cat2 As admin create a category calendar event in Cat1, Cat2 and in SubCat1.1 Create one course under SubCat1.1 category and enrole one user as student. Create a Token in the mobile app service for the user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, courseid with the course created one and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'options [userevents] =0&options [siteevents] =0&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_calendar_get_calendar_events&wstoken=12a2a65aeea2a177055e233f9e303218&events [courseids] [0] =23' --compressed | python -m "json.tool" Check that you receive the category events created for Cat1 and SubCat1.1 Now, execute the following WS request replacing the categoryid with the SubCat1.1 category id curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'options [userevents] =0&options [siteevents] =0&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_calendar_get_calendar_events&wstoken=12a2a65aeea2a177055e233f9e303218&events [categoryids] [0] =23' --compressed | python -m "json.tool" Check that you receive the category events created for Cat1 and SubCat1.1 Execute the same WS request but using as category id the Cat1 one Check that you receive only the category event created for Cat1 Execute the same WS request but using as category id the Cat2 one Check that you don't receive any category event

      In -MDL-60628-, some code was introduced to return category events in core_calendar_get_calendar_events. However, the category events cannot be received by students.

      The reason is that the event mapper doesn't return categoryid for the events (see here). Since events don't have categoryid, this condition isn't fulfilled and the events are filtered.

      I checked the unit tests that were added for this and they are wrong. The event received by the student in this test is "site", and the events received by the admin in this test are "site" and "user".

            jleyva Juan Leyva
            dpalou Dani Palou
            Dani Palou Dani Palou
            Jun Pataleta Jun Pataleta
            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.