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

Export user grades as XML doesn't encode user or grade idnumbers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9.4
    • Fix Version/s: 3.9.7, 3.10.4
    • Component/s: Gradebook
    • Labels:
    • Testing Instructions:
      Hide

      Setup

      1. Login as admin
      2. Create two new users:
        1. User: "User 1", ID number: "u1" (without quotes)
        2. User: "User 2", ID number:

          'Bill'&"Ben"<tag>Hello</tag>

      Export

      1. Create a new course
      2. Enrol both users as students
      3. Add an assignment to the course with the following ID number(Common module settings):

        assignment&<code>101</code>

      4. From the assignment page press Grade and give the following:
        1. User 1: 75
        2. User 2: 90
      5. Click on Grades in course navigation
      6. Select Export > XML file
      7. Press Download and save the file to your computer
      8. Open the XML file and confirm the assignment/student entities are encoded correctly, e.g.

        <results batch="xml_export_1614643952">
        	<result>
        		<assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment>
        		<student>u1</student>
        		<score>75.00</score>
        	</result>
        	<result>
        		<assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment>
        		<student>&apos;Bill&apos;&amp;&quot;Ben&quot;&lt;tag&gt;Hello&lt;/tag&gt;</student>
        		<score>90.00</score>
        	</result>
        </results>
        

      Import

      1. Delete the previous course
      2. Create a new course
      3. Enrol both users as students
      4. Add an assignment to the course with the following ID number (Common module settings):

        assignment&<code>101</code>

      5. Click on Grades in course navigation
      6. Select Import > XML file
      7. Upload the file you previously exported
      8. Press Upload grades
      9. Confirm you see the message "Grade import success"
      10. Click on Grades in course navigation
      11. Confirm that each user has the following grade for your assignment as follows:
        1. User 1: 75
        2. User 2: 90
      Show
      Setup Login as admin Create two new users: User: "User 1", ID number: "u1" (without quotes) User: "User 2", ID number: 'Bill'&"Ben"<tag>Hello</tag> Export Create a new course Enrol both users as students Add an assignment to the course with the following ID number(Common module settings): assignment&<code>101</code> From the assignment page press Grade and give the following: User 1: 75 User 2: 90 Click on Grades in course navigation Select Export > XML file Press Download and save the file to your computer Open the XML file and confirm the assignment/student entities are encoded correctly, e.g. <results batch="xml_export_1614643952"> <result> <assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment> <student>u1</student> <score>75.00</score> </result> <result> <assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment> <student>&apos;Bill&apos;&amp;&quot;Ben&quot;&lt;tag&gt;Hello&lt;/tag&gt;</student> <score>90.00</score> </result> </results> Import Delete the previous course Create a new course Enrol both users as students Add an assignment to the course with the following ID number (Common module settings): assignment&<code>101</code> Click on Grades in course navigation Select Import > XML file Upload the file you previously exported Press Upload grades Confirm you see the message "Grade import success" Click on Grades in course navigation Confirm that each user has the following grade for your assignment as follows: User 1: 75 User 2: 90
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Pull 3.9 Branch:
    • Pull 3.10 Branch:
      MDL-71016-310
    • Pull 3.11 Branch:
      MDL-71016-311
    • Pull Master Branch:

      Description

      User & grade idnumber are written without encoding, which can lead to malformed XML

      According to this reference, these characters need encoding in XML text elements

      "   &quot;
      '   &apos;
      <   &lt;
      >   &gt;
      &   &amp;
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pholden Paul Holden
              Reporter:
              pholden Paul Holden
              Peer reviewer:
              Peter Dias Peter Dias
              Integrator:
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Tester:
              Anna Carissa Sadia Anna Carissa Sadia
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/May/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours, 15 minutes
                  5h 15m