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

gradereport_user_view_grade_report

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.5
    • Fix Version/s: 2.9
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

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

      1. Create a course with the enablegrades option enabled.
      2. Access with a teacher account to the course in Moodle, go to Administration / grades / View user report
      3. As a teacher or admin, check that in the Report / Logs you see the "Grade user report viewed" actions.
      4. As admin, enable "Mobile services": Plugins ► Web Services ► External services
      5. Create a Token for a student user (not admin) in the course (create a token for a course teacher or admin too):
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=4&userid=0&wsfunction=gradereport_user_view_grade_report&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e'

      7. Confirm that
        • You can see new entries in the course log (Grade user report viewed) for that course and the user. The origin for the new log entries is "ws"
        • If you change userid to a different user, you will get a no permissions to view grades error
        • If you change courseid to an non-existent course you got an error
        • If you change courseid to a course where you are not enrolled you got an error
      8. Now replace the token with a teacher or admin one, and then replace userid to a valid user. Then you should see in the course log table new events (Grade user report viewed) with the specified user as affected
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service. Create a course with the enablegrades option enabled. Access with a teacher account to the course in Moodle, go to Administration / grades / View user report As a teacher or admin, check that in the Report / Logs you see the "Grade user report viewed" actions. As admin, enable "Mobile services": Plugins ► Web Services ► External services Create a Token for a student user (not admin) in the course (create a token for a course teacher or admin too): Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=4&userid=0&wsfunction=gradereport_user_view_grade_report&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' Confirm that You can see new entries in the course log (Grade user report viewed) for that course and the user. The origin for the new log entries is "ws" If you change userid to a different user, you will get a no permissions to view grades error If you change courseid to an non-existent course you got an error If you change courseid to a course where you are not enrolled you got an error Now replace the token with a teacher or admin one, and then replace userid to a valid user. Then you should see in the course log table new events (Grade user report viewed) with the specified user as affected
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49500-master

      Description

      Trigger the grade_report_viewed event when a user view his grade report (this web service will be initially used by the mobile app so information can be logged in the Moodle side when a user see the same page in the app).

        Attachments

          Activity

            People

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

              Dates

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