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

Review JSON format for OBv2.1 because in some cases it's not as expected

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • MDL-70963-master
    • Hide

      Tip: Firefox displays JSON files with collapsed information, so it will make easier to find this information.

      Setup badges

      1. Login as admin.
      2. Go to "Site administration | Badges | Add a new badge" and create a badge at site level ("Badge to revoke"):
        • Fill in only the required fields.
      3. Look at the URL and annotate the id for the badge (badges/criteria.php?id=[BADGEID1])
      4. Add criteria to the badge so it can be manually issued by role.
      5. Go to "Site administration | Badges | Add a new badge" and create another badge at site level ("Badge complete").
        • Fill in all the optional "Image author" fields.
        • Set a version
      6. Look at the URL and annotate the id for the badge (badges/criteria.php?id=[BADGEID2])
      7. Add criteria to the badge so it can be manually issued by role.
      8. Add some Endorsement information (you'll need to fill in all the required fields).
      9. Add, at least, one alignment.
      10. Access to "Related badges" and add "Badge to revoke" as related badge.
      11. Enable both badges.
      12. Issue the badges to the admin user.

      Setup backpack

      1. Login as admin.
      2. Go to "Site administration > Badges > Manage backpacks" and "Add a new backpack" with "API version supported" set to "Open Badges v2.1". Fill-in the required fields with some URL (for instance, http://myurl.cat).
      3. Access to "Site administration > Badges > Backpack settings" and set "Active external backpack" to the one you've created in the previous step.
        • ATTENTION: Once MDL-70911 lands in 3.11 and master, the active external backpack will need to be changed from "Site administration > Badges > Manage backpacks": it will be the first one on the top of the list so, for changing it, you'll need to change the order using the up/down arrows.

       

      Testing scenario 1: Revoke badge

      1. Access to admin profile page.
      2. Access to "Badge to revoke".
      3. In the URL, replace "badges/badge.php?hash=" to "badges/assertion.php?b=". 
      4. Check there is no "revoked" element in this JSON.
      5. Annotate the previous URL (you'll need later again).
      6. Go to "Site administration > Badges > Manage badges" and access to "Award badge" page for the "Badge to revoke".
      7. Revoke badge for admin user.
      8. Access again to the URL stored previously (badges/badge.php?hash=xxxx).
      9. Check now this JSON files only contains 2 fields: id (with a URL) and revoked set to true.

      Testing scenario 2: Expected fields for badges when backpack is OBv2.1 compliant

      1. Access to admin profile page.
      2. Access to "Badge complete".
      3. In the URL, replace "badges/badge.php?hash=" to "badges/assertion.php?b=". 
      4. Check the "badge" element doesn't contain URL to /badges/assertion.php. It should have a URL pointing to badges/badge_json.php?id=[BADGEID2].
      5. Check the JSON contains the following fields: @language, version, endorsement, alignments and related.
      Show
      Tip : Firefox displays JSON files with collapsed information, so it will make easier to find this information. Setup badges Login as admin. Go to "Site administration | Badges | Add a new badge" and create a badge at site level ("Badge to revoke"): Fill in only the required fields. Look at the URL and annotate the id for the badge (badges/criteria.php?id= [BADGEID1] ) Add criteria to the badge so it can be manually issued by role. Go to "Site administration | Badges | Add a new badge" and create another badge at site level ("Badge complete"). Fill in all the optional "Image author" fields. Set a version Look at the URL and annotate the id for the badge (badges/criteria.php?id= [BADGEID2] ) Add criteria to the badge so it can be manually issued by role. Add some Endorsement information (you'll need to fill in all the required fields). Add, at least, one alignment. Access to "Related badges" and add "Badge to revoke" as related badge. Enable both badges. Issue the badges to the admin user. Setup backpack Login as admin. Go to "Site administration > Badges > Manage backpacks" and "Add a new backpack" with "API version supported" set to "Open Badges v2.1". Fill-in the required fields with some URL (for instance, http://myurl.cat ). Access to "Site administration > Badges > Backpack settings" and set "Active external backpack" to the one you've created in the previous step. ATTENTION: Once  MDL-70911 lands in 3.11 and master, the active external backpack will need to be changed from "Site administration > Badges > Manage backpacks": it will be the first one on the top of the list so, for changing it, you'll need to change the order using the up/down arrows.   Testing scenario 1: Revoke badge Access to admin profile page. Access to "Badge to revoke". In the URL, replace "badges/badge.php?hash=" to "badges/assertion.php?b=".  Check  there is no "revoked" element in this JSON. Annotate the previous URL (you'll need later again). Go to "Site administration > Badges > Manage badges" and access to "Award badge" page for the "Badge to revoke". Revoke badge for admin user. Access again to the URL stored previously (badges/badge.php?hash=xxxx). Check  now this JSON files only contains 2 fields: id (with a URL) and revoked set to true. Testing scenario 2: Expected fields for badges when backpack is OBv2.1 compliant Access to admin profile page. Access to "Badge complete". In the URL, replace "badges/badge.php?hash=" to "badges/assertion.php?b=".  Check the "badge" element doesn't contain URL to /badges/assertion.php. It should have a URL pointing to badges/badge_json.php?id= [BADGEID2] . Check the JSON contains the following fields: @language, version, endorsement, alignments and related.
    • Moppies Kanban

      While working on MDL-63961 I've realised JSON files haven't the expected format for OBv2.1 badges (in some cases they are using OBv1.0 fields) because there are some comparisons with OPEN_BADGES_v2. For instance, here: https://github.com/moodle/moodle/blob/master/badges/classes/assertion.php#L328

      This issue should review all these checks and fix them to guarantee the format for OBv2.1 is the expected.

            sarjona Sara Arjona (@sarjona)
            sarjona Sara Arjona (@sarjona)
            Amaia Anabitarte Amaia Anabitarte
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 30 minutes
                3h 30m

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