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

get_databases_by_courses does not return information for global admins or managers (and teachers)

XMLWordPrintable

    • MOODLE_29_STABLE
    • MOODLE_29_STABLE
    • MDL-49937-master
    • Hide
      1. As admin or teacher, create a course with a database
      2. Enable "Mobile services": Plugins ► Web Services ► Mobile
      3. Create a Token for the Moodle main admin user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a CURL REST call simulating a WS client.
        • You need to replace the wstoken and URL.
        • You need to replace also the courseids value to match the course you created in the first step.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_data_get_databases_by_courses&wstoken=ffbe3a3002f235bf9d01fd9369e10b66'

          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
        • The json returned contains the database complete information (all the info).
        • You don't see any warnings in the json response
      Show
      As admin or teacher, create a course with a database Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the Moodle main admin user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client. You need to replace the wstoken and URL. You need to replace also the courseids value to match the course you created in the first step. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_data_get_databases_by_courses&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' 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 The json returned contains the database complete information (all the info). You don't see any warnings in the json response

      Similar bug reported here (MDL-49921)

      The main problem is that instead use only validate_context the courses are checked also using the results of the get_enrolled_courses function

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            David Monllaó David Monllaó
            Jetha Chan Jetha Chan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.