Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-49036

gradereport_user_get_grades_table

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Note: Version number is bumped because a new web service is added into the Mobile app service and also in a component.

      1. Create a course with a couple of students with grades in an activity (assignment, etc..) and a teacher. Check that the grades are correctly displayed in the course gradebook
      2. Enable "Mobile services": Plugins ► Web Services ► External services
      3. Create a Token for the teacher and one of the students:
        • 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 .
        • First call as a teacher (for retrieving all the student grades), replace the token with the teacher one, replace the courseid value and userid should be = 0
        • Second call as a student (for retrieving your own grades), replace the token with the student one, and userid should be the student userid
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'courseid=2&userid=4&wsfunction=gradereport_user_get_grades_table&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed
          

      5. Confirm that (you should use jsonlint.com for formatting the output):
        • As a teacher you can see all the student grades (You will see a table structure for each student includen a column with the activity name and grade)
        • As a student, you can see only your own grades
      6. Do additional requests for testing permissions. Like as a student replace the token with the student one, and userid = 0. It should return and error regarding invalid permissions
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service and also in a component. Create a course with a couple of students with grades in an activity (assignment, etc..) and a teacher. Check that the grades are correctly displayed in the course gradebook Enable "Mobile services": Plugins ► Web Services ► External services Create a Token for the teacher and one of the students: 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 . First call as a teacher (for retrieving all the student grades), replace the token with the teacher one, replace the courseid value and userid should be = 0 Second call as a student (for retrieving your own grades), replace the token with the student one, and userid should be the student userid You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'courseid=2&userid=4&wsfunction=gradereport_user_get_grades_table&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed Confirm that (you should use jsonlint.com for formatting the output): As a teacher you can see all the student grades (You will see a table structure for each student includen a column with the activity name and grade) As a student, you can see only your own grades Do additional requests for testing permissions. Like as a student replace the token with the student one, and userid = 0. It should return and error regarding invalid permissions
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49036-master

      Description

      This WS will return the user grade report users table for one or more users.

      The returned information is a data structure ready to be formatted as a tablet/grid displaying grades, categories, nested categories, etc...

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/15