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

Let users define their preferred backpack

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Before upgrade:

      Prerequisites

      1. SMTP setup for the site, perhaps using mailcatcher.
      2. Run your site with public access (use ngrok or similar)
      3. Create 3 badgr account on badgr.io (US)
        1. Account 1 as Admin (Use as system badge account)
        2. Account 2 and 3 as Student/Regular user accounts
      4. Create another account on eu.badgr.io (Use as user badge account)
      5. An admin and 5 students available in the system.
      6. Setup badges for the Moodle site as described here
        1. In "Site administration / Badges / Badges settings", set the issuer site backpack with Badgr Account1
        2. In "Site administration / Badges / Manage backpacks", edit the https://badgri.io backpack and set the password.
      7. As student1, go to "Dashboard / Preferences / Badges / Backpack settings", connect Badgr (ussing Account2) and set it to a 'Connected' state (you'll need to check the email to verify the account).

      OAuth2 setup for OBv2.1

      1. Login as admin.
      2. Access to the "Site home" and "Turn editing on".
      3. Add a label, upload an image there and save changes.
      4. Right-click over the uploaded image and copy the image address. You'll need to replace "https://471f8462.ngrok.io/m/stable_master/pluginfile.php/41/mod_label/intro/logo.png" of the next command to the copied image URL.
      5. Register the oAuth2 service in the IMS Global IdentityServer4 executing the following command, replacing "https://471f8462.ngrok.io/" by your server URL. You'll probably need to adapt "https://471f8462.ngrok.io/m/stable_master/" to your Moodle URL:

        curl --location --insecure --request POST 'https://dc.imsglobal.org/obauth/connect/register' \
        --header 'Accept: application/json' \
        --header 'Content-Type: application/json' \
        --data-raw '
        {
          "client_name": "Badge Moodle",
          "client_uri": "https://471f8462.ngrok.io/",
          "logo_uri": "https://471f8462.ngrok.io/m/stable_master/pluginfile.php/41/mod_label/intro/logo.png",
          "tos_uri": "https://471f8462.ngrok.io/",
          "policy_uri": "https://471f8462.ngrok.io/",
          "software_id": "stablemaster-testing",
          "software_version": "2020041700.01",
          "redirect_uris": [
            "https://471f8462.ngrok.io/m/stable_master/badges/oauth2callback.php"
          ],
          "token_endpoint_auth_method": "client_secret_basic",
          "grant_types": [
            "authorization_code",
            "refresh_token"
          ],
          "response_types": [
            "code"
          ],
          "scope": "https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.update https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly offline_access"
        }'

      6. You should get a result like this. Copy the client_id and the client_secret (you'll need them to configure the oAuth2 service)

        {
          "client_id": "LGC8WEFTxp8",
          "client_secret": "3GAfOtFgflA",
          "client_id_issued_at": 1587110808,
          "client_secret_expires_at": 1618646808,
          "client_name": "Badge OU",
          "client_uri": "https://471f8462.ngrok.io/",
          "logo_uri": "https://471f8462.ngrok.io/m/stable_master-badges/pluginfile.php/41/mod_label/intro/robot-1214536_1920.png",
          "tos_uri": "https://471f8462.ngrok.io/",
          "policy_uri": "https://471f8462.ngrok.io/",
          "software_id": "13dcdc83-fc0d-4c8d-9159-6461da297388",
          "software_version": "54dfc83-fc0d-4c8d-9159-6461da297388",
          "redirect_uris": [
            "https://471f8462.ngrok.io/m/stable_master/badges/oauth2callback.php"
          ],
          "token_endpoint_auth_method": "client_secret_basic",
          "grant_types": [
            "authorization_code",
            "refresh_token"
          ],
          "response_types": [
            "code"
          ],
          "scope": "https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.update https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly offline_access"
        

      7. Go to "Site administration / Server / OAuth 2 services".
      8. Create a custom service with the following information:
        • Name: "IMS Global"
        • Client ID: <previous client_id>
        • Client secret: <previous client_secret>
        • Enable Authenticate token requests via HTTP headers
        • Scopes included in a login request and Scopes included in a login request for offline access: "openid profile email"
        • Service base URL: https://dc.imsglobal.org/obauth
        • Logo URL: https://dc.imsglobal.org/obauth/icon.jpg 
      9. Save changes. 

      OBv2.1 setup - Create new backpack

      1. In Site admin -> Badges -> Manage backpacks
      2. Create a new backpack with the following details :
        1. Backpack API URL - https://dc.imsglobal.org/obprovider/ims/ob/v2p1
        2. Backpack URL - https://dc.imsglobal.org
        3. API Version - Open Badges v2.1
        4. OAuth2 services - IMS Global
      3. Save changes.
      4. Edit the backpack and set OAuth2 services to IMS Global again (this is a workaround for MDL-70025).

      After upgrade

      Testing Instructions :

      1. Apply the patch and proceed through the upgrade steps
      2. Log in as an admin
      3. Upgrade the site
      4. Go to Site admin -> Badges -> Manage backpacks
      5. Confirm the previously setup backpacks exist with their auth details setup.
      6. Create this backpack with the following details:
      7. Confirm you do not have any issues creating the backpacks as defined.
      8. Go to Site Admin -> Badges -> Add a new badge
      9. Follow the details here to create a new badge with the setting
        • Criteria - 'Manual issue by role' - Teacher
        • Enable access
      10. Award the badge to all of the students
      11. Log in as student 1 and go to the Preferences -> Badges -> Backpack settings
      12. Confirm the backpack is still marked as connected.
      13. Log in as student 2
      14. Go to Preferences -> Backpack settings
      15. Confirm you can select the backpack provider
      16. Select and add the credentials for the eu backpack and save
      17. Go to your email used to register the eu account.
      18. Click on the confirmation link in the email sent from Moodle.
      19. Confirm the backpack is now displayed as connected in your Moodle site.
      20. Go to 'Manage badges' in the user preferences.
      21. In the listed badges, click on the add to backpack.
      22. Confirm you see the 'Added badge to backpack' message
      23. Log in to the eu badgr account and confirm you see the badge you created on Moodle in your backpack (sometimes waiting for a few minutes is required before the badges are displayed in the badgr backpak)
      24. In the eu badgr account, create a collection with some of the badges awarded and mark it as public
      25. As student2, go to Preferences -> Backpack settings
      26. In 'Badge import settings', confirm the collection created is listed here.
      27. Enable the checkbox against the collection listed and save changes
      28. Confirm you are taken to the 'My badges' page and can see the badges from the collection under 'My badges from other web sites'

      Cross standards update - OB2 Site backpack -> OBv2.1 User backpack

      1. As student 3 go to Preferences -> Backpack settings
      2. Select the "IMS Global" provider
      3. Confirm you only see the Backpack provider and status fields
      4. Proceed with connecting to the backpack using the OAuth2 workflow:
        • First you'll need to grant the permission clicking the "Yes, allow" button.
        • Then you'll need to add the credentials alice / alice , for instance (credentials shown on the provider's page)
      5. After the OAuth flow, confirm you are redirected to your Moodle site and are shown the badges that you're awarded.
      6. In the listed badges, click on the add to backpack.
      7. Confirm you see the 'Added badge to backpack' message

      Cross standards update - OB2.1 Site backpack -> OBv2 User backpack

      1. As an admin, go to "Site administration / Badges / Backpack settings"
      2. Change 'Active external backpack' to the IMS Global provider
      3. As student 1 (Backpack should already be connected from before)
      4. Go to 'Manage badges' in the user preferences.
      5. In the listed badges, click on the add to backpack
      6. Confirm you see the 'Added badge to backpack' message
      7. Log in to the student's badgr account and confirm you see the badge you created on Moodle in your backpack
      8. Repeat #14-#289 as student 4 and with the 3rd US Badgr Account

       
       

      Show
      Before upgrade : Prerequisites SMTP setup for the site, perhaps using mailcatcher. Run your site with public access (use ngrok or similar) Create 3 badgr account on badgr.io (US) Account 1 as Admin (Use as system badge account) Account 2 and 3 as Student/Regular user accounts Create another account on eu.badgr.io (Use as user badge account) An admin and 5 students available in the system. Setup badges for the Moodle site as described here :  In "Site administration / Badges / Badges settings", set the issuer site backpack with Badgr Account1 In "Site administration / Badges / Manage backpacks", edit the https://badgri.io  backpack and set the password. As student1, go to "Dashboard / Preferences / Badges / Backpack settings", connect Badgr (ussing Account2) and set it to a 'Connected' state (you'll need to check the email to verify the account). OAuth2 setup for OBv2.1 Login as admin. Access to the "Site home" and "Turn editing on". Add a label, upload an image there and save changes. Right-click over the uploaded image and copy the image address. You'll need to replace "https://471f8462.ngrok.io/m/stable_master/pluginfile.php/41/mod_label/intro/logo.png" of the next command to the copied image URL. Register the oAuth2 service in the IMS Global IdentityServer4 executing the following command, replacing "https://471f8462.ngrok.io/" by your server URL. You'll probably need to adapt "https://471f8462.ngrok.io/m/stable_master/" to your Moodle URL: curl --location --insecure --request POST 'https://dc.imsglobal.org/obauth/connect/register' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data-raw ' { "client_name": "Badge Moodle", "client_uri": "https://471f8462.ngrok.io/", "logo_uri": "https://471f8462.ngrok.io/m/stable_master/pluginfile.php/41/mod_label/intro/logo.png", "tos_uri": "https://471f8462.ngrok.io/", "policy_uri": "https://471f8462.ngrok.io/", "software_id": "stablemaster-testing", "software_version": "2020041700.01", "redirect_uris": [ "https://471f8462.ngrok.io/m/stable_master/badges/oauth2callback.php" ], "token_endpoint_auth_method": "client_secret_basic", "grant_types": [ "authorization_code", "refresh_token" ], "response_types": [ "code" ], "scope": "https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.update https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly offline_access" }' You should get a result like this. Copy the client_id and the client_secret (you'll need them to configure the oAuth2 service) { "client_id": "LGC8WEFTxp8", "client_secret": "3GAfOtFgflA", "client_id_issued_at": 1587110808, "client_secret_expires_at": 1618646808, "client_name": "Badge OU", "client_uri": "https://471f8462.ngrok.io/", "logo_uri": "https://471f8462.ngrok.io/m/stable_master-badges/pluginfile.php/41/mod_label/intro/robot-1214536_1920.png", "tos_uri": "https://471f8462.ngrok.io/", "policy_uri": "https://471f8462.ngrok.io/", "software_id": "13dcdc83-fc0d-4c8d-9159-6461da297388", "software_version": "54dfc83-fc0d-4c8d-9159-6461da297388", "redirect_uris": [ "https://471f8462.ngrok.io/m/stable_master/badges/oauth2callback.php" ], "token_endpoint_auth_method": "client_secret_basic", "grant_types": [ "authorization_code", "refresh_token" ], "response_types": [ "code" ], "scope": "https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.update https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly offline_access" Go to "Site administration / Server / OAuth 2 services". Create a custom service with the following information: Name: "IMS Global" Client ID: <previous client_id> Client secret: <previous client_secret> Enable Authenticate token requests via HTTP headers Scopes included in a login request and Scopes included in a login request for offline access: "openid profile email" Service base URL: https://dc.imsglobal.org/obauth Logo URL: https://dc.imsglobal.org/obauth/icon.jpg   Save changes.  OBv2.1 setup - Create new backpack In Site admin -> Badges -> Manage backpacks Create a new backpack with the following details : Backpack API URL - https://dc.imsglobal.org/obprovider/ims/ob/v2p1 Backpack URL - https://dc.imsglobal.org API Version - Open Badges v2.1 OAuth2 services - IMS Global Save changes. Edit the backpack and set OAuth2 services to IMS Global again (this is a workaround for  MDL-70025 ). After upgrade Testing Instructions : Apply the patch and proceed through the upgrade steps Log in as an admin Upgrade the site Go to Site admin -> Badges -> Manage backpacks Confirm the previously setup backpacks exist with their auth details setup. Create this backpack with the following details: Backpack API - https://api.eu.badgr.io/v2 Backpack URL - https://eu.badgr.io API Version - Open Badges v2.0 Include authentication details with the backpack - Disabled Confirm you do not have any issues creating the backpacks as defined. Go to Site Admin -> Badges -> Add a new badge Follow the details here to create a new badge with the setting Criteria - 'Manual issue by role' - Teacher Enable access Award the badge to all of the students Log in as student 1 and go to the Preferences -> Badges -> Backpack settings Confirm the backpack is still marked as connected. Log in as student 2 Go to Preferences -> Backpack settings Confirm you can select the backpack provider Select and add the credentials for the eu backpack and save Go to your email used to register the eu account. Click on the confirmation link in the email sent from Moodle. Confirm the backpack is now displayed as connected in your Moodle site. Go to 'Manage badges' in the user preferences. In the listed badges, click on the add to backpack. Confirm you see the 'Added badge to backpack' message Log in to the eu badgr account and confirm you see the badge you created on Moodle in your backpack (sometimes waiting for a few minutes is required before the badges are displayed in the badgr backpak) In the eu badgr account, create a collection with some of the badges awarded and mark it as public As student2, go to Preferences -> Backpack settings In 'Badge import settings', confirm the collection created is listed here. Enable the checkbox against the collection listed and save changes Confirm you are taken to the 'My badges' page and can see the badges from the collection under 'My badges from other web sites' Cross standards update - OB2 Site backpack -> OBv2.1 User backpack As student 3 go to Preferences -> Backpack settings Select the "IMS Global" provider Confirm you only see the Backpack provider and status fields Proceed with connecting to the backpack using the OAuth2 workflow: First you'll need to grant the permission clicking the "Yes, allow" button. Then you'll need to add the credentials alice / alice , for instance (credentials shown on the provider's page) After the OAuth flow, confirm you are redirected to your Moodle site and are shown the badges that you're awarded. In the listed badges, click on the add to backpack. Confirm you see the 'Added badge to backpack' message Cross standards update - OB2.1 Site backpack -> OBv2 User backpack As an admin, go to "Site administration / Badges / Backpack settings" Change 'Active external backpack' to the IMS Global provider As student 1 (Backpack should already be connected from before) Go to 'Manage badges' in the user preferences. In the listed badges, click on the add to backpack Confirm you see the 'Added badge to backpack' message Log in to the student's badgr account and confirm you see the badge you created on Moodle in your backpack Repeat #14-#289 as student 4 and with the 3rd US Badgr Account    
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull from Repository:
    • Pull 3.10 Branch:
      MDL-65959-310
    • Pull Master Branch:
      MDL-65959-master
    • Story Points:
      5
    • Sprint:
      3.9 release work board, 4.0 holding pattern, 4.0 holding pattern 2, 4.0 holding pattern 3, 4.0 holding pattern 4, 4.0 holding pattern 5, 4.0 holding pattern 6, 4.0 holding pattern 7

      Description

      Currently, all the users can only use the site default backpack. It would be great to let each user specify and configure their preferred backpack.

      The default site backpack will be the first one displayed for the users without any backpack, but then they should be able to change, configure and use it.

      Apart from that, it will be also great let the admins add/remove/enable/disable the site backpacks (that part could be treated on a separate issue, to make easier this one).

      In the future, it would be also good letting users configure more than one backpack (that part could also be treated on a separate issue).

        Attachments

        1. backpack_settings_for_user.png
          backpack_settings_for_user.png
          41 kB
        2. MDL-65959.jpg
          MDL-65959.jpg
          56 kB
        3. MDL-65959 (2).jpg
          MDL-65959 (2).jpg
          44 kB
        4. undefinedopenbadgeid.png
          undefinedopenbadgeid.png
          81 kB

          Issue Links

            Activity

              People

              Assignee:
              peterdias Peter Dias
              Reporter:
              sarjona Sara Arjona (@sarjona)
              Peer reviewer:
              Mathew May
              Integrator:
              Sara Arjona (@sarjona)
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Yuliya Bozhko, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              10 Vote for this issue
              Watchers:
              19 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 weeks, 3 days, 6 hours, 1 minute
                  4w 3d 6h 1m