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

Calendar required changes for the mobile app (to allow events creation)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.2
    • Fix Version/s: 3.7
    • Component/s: Calendar, Web Services
    • Labels:
    • 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 any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_calendar_get_allowed_event_types&wstoken=3af67232a7596ceb658df4db329e5ad6' | python -m "json.tool"

      4. Check that:
        • allowedeventtypes field returns only one value "user" - Because you are allowed to create only user calendar events
      5. Now replace the wsfunction value with: core_calendar_get_calendar_access_information and execute the curl request checking that:
        • All the returned fields "canxxx" must be set to false except "canmanageownentries" that is set to true
      6. Now, as admin, create a new course, enrol one user in it as editing teacher and generate a wstoken for the teacher you just enrolled in the new course.
      7. Execute the following CURL requestusing the wstoken for the teacher and the course id with the course you just created.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_calendar_get_allowed_event_types&wstoken=3af67232a7596ceb658df4db329e5ad6&courseid=COURSE' | python -m "json.tool"

      8. Check that
        • allowedeventtypes field now returns user and course (and, if the course is configured to use groups and at least one group is created it will return also "group")
      9. Now replace the wsfunction value with: core_calendar_get_calendar_access_information and execute the curl request checking that:
        • All the returned fields "canxxx" must be set to true
      10. Finally, execute the following curl request using the teacher or student token:

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=tool_mobile_get_config&wstoken=3af67232a7596ceb658df4db329e5ad6&section=calendar' | python -m "json.tool"

      11. Check that
        • you see several fields starting by "calendar" that maches the configuration values in the Moodle site (as admin, you can go to the calendar settings section in the site administration and match the values, please ommit to check the calendar_startwday value because itmay be confussing)
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_calendar_get_allowed_event_types&wstoken=3af67232a7596ceb658df4db329e5ad6' | python -m "json.tool" Check that: allowedeventtypes field returns only one value "user" - Because you are allowed to create only user calendar events Now replace the wsfunction value with: core_calendar_get_calendar_access_information and execute the curl request checking that: All the returned fields "canxxx" must be set to false except "canmanageownentries" that is set to true Now, as admin, create a new course, enrol one user in it as editing teacher and generate a wstoken for the teacher you just enrolled in the new course. Execute the following CURL requestusing the wstoken for the teacher and the course id with the course you just created. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_calendar_get_allowed_event_types&wstoken=3af67232a7596ceb658df4db329e5ad6&courseid=COURSE' | python -m "json.tool" Check that allowedeventtypes field now returns user and course (and, if the course is configured to use groups and at least one group is created it will return also "group") Now replace the wsfunction value with: core_calendar_get_calendar_access_information and execute the curl request checking that: All the returned fields "canxxx" must be set to true Finally, execute the following curl request using the teacher or student token: curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=tool_mobile_get_config&wstoken=3af67232a7596ceb658df4db329e5ad6&section=calendar' | python -m "json.tool" Check that you see several fields starting by "calendar" that maches the configuration values in the Moodle site (as admin, you can go to the calendar settings section in the site administration and match the values, please ommit to check the calendar_startwday value because itmay be confussing)
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-64641-master

      Description

      Data required by the mobile app to be able to create calendar events:

      • Allowed event types for the course where the event it is being created: Can be obtained
        via calendar_get_allowed_event_types
      • List of all categories: view the code..
      • Whether the course selector should display all courses or only the enrolled ones: view the code.
      • List of courses with/without groups. When the user selects the "Group" option, only the courses that have groups are displayed. I guess this can be calculated in the app, but it could require several WS calls. View the code.

        Attachments

        1. MDL-64641.jpg
          MDL-64641.jpg
          64 kB
        2. step#11.jpg
          step#11.jpg
          26 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 5 hours, 15 minutes
                  1d 5h 15m