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

Update user sync task to support 1.3 messages

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MDL-69545-master
    • Hide

      Note: Member sync is covered by unit tests, however, it's probably a good idea to test manually to verify the tests are making the right assertions.

      Prerequisites

      1. Create two Moodle sites running on localhost - one designated 'platform', one 'tool'.
      2. In both sites, go to admin settings and clear all values from the 'curlsecurityblockedhosts' admin setting and save.
      3. In the platform site, create a course called "Platform course 1", with:
        • 5 Students: s1, s2, s3, s4, s5
        • 2 Teachers: t1 and t2
      4. In the tool site, create a course called "Tool course 1", with:
        • An assignment called "Assign 1" with a max grade of 80.
        • An assignment called "Assign 2" with default settings (max grade of 100)
        • A file resource (representing a non-graded activity)
        • A single teacher, t1, enrolled.
      5. In the tool site admin settings:
        • Enable enrol_lti and auth_lti plugins
        • Enable "Allow frame embedding"

      Register the tool and platform

      Note: This is a shortened process for setting up the Moodle LTI Advantage Tool. If you've already set this up as part of another test, you can safely skip this section.

      1. On the tool site, go to Admin > Plugins > Enrolments > Publish as LTI tool > Tool registration
      2. Access to "Manual registration"  and keep this page open, we'll need it shortly.
      3. On the platform site, go to 'Admin > Plugins > Activity modules > External tool > Manage tools'
      4. Click 'Configure a tool manually'
      5. Enter the following values:
        • In "Name" enter "Moodle LTI Advantage Tool"
        • Set 'LTI Version' to 1.3
        • Set public key type to 'Keyset URL'
        • In 'Tool URL', paste the value copied from "Tool URL" in the tool.
        • In 'Public keyset' paste the value copied from"JWKS URL" in the tool
        • In 'Initiate login URL', paste the value copied from "Initiate login URL" in the tool
        • In 'Redirection URI(s)' paste the value copied from BOTH "Tool URL" and "Deep linking URL" rows in the tool. Make sure each is on its own line.
        • Check 'Supports deep linking'
        • In 'Content selection URL', paste the value copied from "Deep linking URL" in the tool
        • Under "Services" set "IMS LTI Assignment and Grade Services" to "Use this service for grade sync and column management"
        • Under "Services" set "IMS LTI Names and Role Provisioning" to "Use this service to retrieve members' information as per privacy settings"
        • Set tools settings to "Do not use this service"
        • Set "Tool configuration usage" to "Show in activity chooser and as a preconfigured tool"
      6. Save the tool (you'll be taken to the manage tools page again)
      7. For the tool you just created, click "View configuration details"
      8. Copy these configuration details somewhere, or be ready to access them again.
      9. Now, switch back to the tool site
      10. Under "Registered platforms" click "Register a platform"
      11. Enter the following values:
        • Set "Platform name" to 'Moodle platform'
        • In "Platform Id (Issuer)" paste the value you copied from the "Platform ID" field in the configuration details
        • In "Client ID" paste the value you copied from the "Client ID" field in the configuration details
        • In "Authentication request URL" paste the value you copied from "Authentication request URL" in the configuration details
        • In "Public keyset URL" paste the value you copied from "Public keyset URL" in the configuration details
        • In "Access token URL" paste the value you copied from "Access token URL" in the configuration details
      12. Save changes
      13. Click "Manage deployments" next to the registration you just created
      14. Click "Add a deployment"
      15. Set the following values:
        • In "Name" enter "Site wide deployment"
        • In "Deployment Id" paste the value you copied from "Deployment Id" in the the configuration details
      16. Save the deployment
      17. Log out of both tool and platform.

      Publish activities and set up platform resource links

      1. Log in to the tool site as t1
      2. Click "Published as LTI Tools" in "Tool course 1" course setting
      3. Click "Add new"
      4. Publish the "Assign 1" resource:
        • Set "Tool to be published" to "Assign 1"
        • Set "Custom instance name" to "Assign 1 enrolment method"
        • Leave the rest as defaults and save
      5. Repeat the process and publish the "Assign 2", making sure to select the "Assign 2" and set the custom instance name to "Assign 2 enrolment method".
      6. Now log out of the tool.
      7. In the platform, log in as teacher t1
      8. Go to "Platform course 1"
      9. Add a label activity "Label 1" in section 1, setting completion to "students can manually mark this activity as complete"
      10. Click to add an activity/resource
      11. Select "Moodle LTI Advantage Tool"
      12. Click "Select content"
      13. Verify you're asked to link your tool account.
      14. Open a new tab and sign in to the tool site as the teacher 't1'
      15. In the original tab, close the modal and click "Select content" again.
      16. Proceed to link your account by clicking the "Link this account" button.
      17. Click continue and when the content selection pane loads, select all check boxes next to "Assign 1" (clicking the left box will automatically check the other)
      18. Click "Add content"
      19. Expand the "Privacy" section of the form and make sure "Share emails with the tool" and "share names with the tool" are both checked.
      20. Save the activity
      21. Repeat the process to create a resource link to "Assign 2" the same way.
      22. Verify both activities are created.
      23. Launch each activity (first launch allows the member sync to take place).
      24. On the course home, edit the "Assign 2" activity
      25. Add an access restriction based on activity completion "The activity Label 1 is marked complete"
      26. Save.
      27. Now, log out of the platform.

      Link level memberships check

      1. Log into the platform as student s1
      2. Go to the course "Platform course 1"
      3. Verify you cannot access "Assign 2"
      4. Manually mark the label as complete.
      5. Verify you can now access "Assign 2"
      6. Launch "Assign 2"
      7. Verify you can view the assignment
      8. Now log out of the platform.
      9. Log in to the platform as user s2
      10. Go to the course "Platform course 1"
      11. Manually set the label "Label 1" as complete but DO NOT launch the "Assign 2" resource.
      12. Log out of the platform.
      13. Log in to the tool as the user t1
      14. Go to the course "Tool course 1"
      15. Go to participants
      16. Verify you see entries for users t1 and s1 from the platform, as follows:
        • t1 will have 2 enrolment methods, one for each assignment.
        • s1 will have 1 enrolment method listed, for Assign 2 only.
      17. Stay on this page.
      18. Now, run the member sync task via cli (in the tool site).

        php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
        

      19. Verify the task runs without any errors.
      20. Go back to the tool participants page and reload.
      21. Verify you now see the following enrolments:
        • User s1 from the platform, with 2 enrolment methods "Assign 1" and "Assign 2"
        • User s2 from the platform, with 2 enrolment methods "Assign 1" and "Assign 2"
        • User s3 from the platform, with 1 enrolment methods "Assign 1"
        • User s4 from the platform, with 1 enrolment methods "Assign 1"
        • User s5 from the platform, with 1 enrolment methods "Assign 1"
        • User t1 from the tool (remember, this user has their account linked during the content creation portion of the test), with 2 enrolment methods "Assign 1" and "Assign 2"
      22. Now, log out of the tool
      23. Log into the tool as the admin user
      24. Go to the course "Tool course 1"
      25. Open "Assign 1" and select "Locally assigned roles" from the module settings menu ("More")
      26. Verify you only see 1 entry for the teacher. Other participants won't have role assignments until they launch the resource for the first time - this is expected.
      27. Go back and open "Assign 2" and select "Locally assigned roles" from module settings now.
      28. Verify you see 2 entries: 1 for the teacher and 1 for the platform user s1. Other participants won't have role assignments until they launch the resource for the first time - this is expected.

      Mode "enrol and unenrol" (the default)

      1. Continuing on from above..
      2. Now, login to the platform as teacher t1
      3. Go to the course "Platform course 1"
      4. Enrol the user s6 as a student
      5. Unenrol user s5
      6. Now, run the member sync task via cli (in the tool site).

        php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
        

      7. Verify the task runs without any errors.
      8. Go back to the tool participants page and reload.
      9. Verify:
        • You don't see the user s5 listed any more
        • You see user s6 listed with 1 enrolment method for "Assign 1".

      Mode "enrol new"

      1. Continuing on from above..
      2. Login to the tool site as the teacher t1
      3. Go to course "Tool course 1"
      4. Click "Published as LTI Tools" in course setting
      5. Edit the published resource "Assign 1"
      6. Expand "Remote system" and set "user sync mode" to "Enrol new users"
      7. Save
      8. Now, login to the platform as teacher t1
      9. Go to the course "Platform course 1"
      10. Unenrol user s6
      11. Enrol user s7 as a student
      12. Now, run the member sync task via cli.

        php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
        

      13. Verify the task runs without any errors.
      14. Go back to the tool participants page and reload.
      15. Verify:
        • You still see the user s6 listed (i.e. they haven't been unenrolled)
        • You see user s7 listed with 1 enrolment method for "Assign 1".

      Mode "unenrol missing"

      1. Continuing on from above..
      2. Login to the tool site as the teacher t1
      3. Go to course "Tool course 1"
      4. Click "Published as LTI Tools" in course setting
      5. Edit the published resource "Assign 1"
      6. Expand "Remote system" and set "user sync mode" to "Unenrol missing"
      7. Save
      8. Now, login to the platform as teacher t1
      9. Go to the course "Platform course 1"
      10. Enrol user s8 as a student
      11. Now, run the member sync task via cli.

        php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
        

      12. Verify the task runs without any errors.
      13. Go back to the tool participants page and reload.
      14. Verify:
        • You don't see user s6 listed (i.e. they have been unenrolled)
        • You see user s7 listed with 1 enrolment method for "Assign 1" (i.e. they haven't been unenrolled)
        • You don't see user s8 listed (i.e. they haven't been enrolled)

      Membership sync disabled

      1. Continuing on from above.
      2. Login to the tool site as the teacher t1
      3. Go to course "Tool course 1"
      4. Click "Published as LTI Tools" in course setting
      5. Edit the published resource "Assign 1"
      6. Expand "Remote system" and set "User sync mode" to "Enrol new and unenrol missing users"
      7. Save
      8. Edit again and set "user synchronisation" to "No"
      9. Save again
      10. Now, run the member sync task via cli.

        php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
        

      11. Verify you don't see any task output mentioning syncing of memberships for resource 'Assign 1'.
      12. Go back to the tool participants page and reload.
      13. Verify:
        • You still don't see user s8 listed (i.e. they haven't been enrolled)
      Show
      Note: Member sync is covered by unit tests, however, it's probably a good idea to test manually to verify the tests are making the right assertions. Prerequisites Create two Moodle sites running on localhost - one designated 'platform', one 'tool'. In both sites, go to admin settings and clear all values from the 'curlsecurityblockedhosts' admin setting and save. In the platform site, create a course called "Platform course 1", with: 5 Students: s1, s2, s3, s4, s5 2 Teachers: t1 and t2 In the tool site, create a course called "Tool course 1", with: An assignment called "Assign 1" with a max grade of 80. An assignment called "Assign 2" with default settings (max grade of 100) A file resource (representing a non-graded activity) A single teacher, t1, enrolled. In the tool site admin settings: Enable enrol_lti and auth_lti plugins Enable "Allow frame embedding" Register the tool and platform Note: This is a shortened process for setting up the Moodle LTI Advantage Tool. If you've already set this up as part of another test, you can safely skip this section. On the tool site, go to Admin > Plugins > Enrolments > Publish as LTI tool > Tool registration Access to "Manual registration"  and keep this page open, we'll need it shortly. On the platform site, go to 'Admin > Plugins > Activity modules > External tool > Manage tools' Click 'Configure a tool manually' Enter the following values: In "Name" enter "Moodle LTI Advantage Tool" Set 'LTI Version' to 1.3 Set public key type to 'Keyset URL' In 'Tool URL', paste the value copied from "Tool URL" in the tool. In 'Public keyset' paste the value copied from"JWKS URL" in the tool In 'Initiate login URL', paste the value copied from "Initiate login URL" in the tool In 'Redirection URI(s)' paste the value copied from BOTH "Tool URL" and "Deep linking URL" rows in the tool. Make sure each is on its own line. Check 'Supports deep linking' In 'Content selection URL', paste the value copied from "Deep linking URL" in the tool Under "Services" set "IMS LTI Assignment and Grade Services" to "Use this service for grade sync and column management" Under "Services" set "IMS LTI Names and Role Provisioning" to "Use this service to retrieve members' information as per privacy settings" Set tools settings to "Do not use this service" Set "Tool configuration usage" to "Show in activity chooser and as a preconfigured tool" Save the tool (you'll be taken to the manage tools page again) For the tool you just created, click "View configuration details" Copy these configuration details somewhere, or be ready to access them again. Now, switch back to the tool site Under "Registered platforms" click "Register a platform" Enter the following values: Set "Platform name" to 'Moodle platform' In "Platform Id (Issuer)" paste the value you copied from the "Platform ID" field in the configuration details In "Client ID" paste the value you copied from the "Client ID" field in the configuration details In "Authentication request URL" paste the value you copied from "Authentication request URL" in the configuration details In "Public keyset URL" paste the value you copied from "Public keyset URL" in the configuration details In "Access token URL" paste the value you copied from "Access token URL" in the configuration details Save changes Click "Manage deployments" next to the registration you just created Click "Add a deployment" Set the following values: In "Name" enter "Site wide deployment" In "Deployment Id" paste the value you copied from "Deployment Id" in the the configuration details Save the deployment Log out of both tool and platform. Publish activities and set up platform resource links Log in to the tool site as t1 Click "Published as LTI Tools" in "Tool course 1" course setting Click "Add new" Publish the "Assign 1" resource: Set "Tool to be published" to "Assign 1" Set "Custom instance name" to "Assign 1 enrolment method" Leave the rest as defaults and save Repeat the process and publish the "Assign 2", making sure to select the "Assign 2" and set the custom instance name to "Assign 2 enrolment method". Now log out of the tool. In the platform, log in as teacher t1 Go to "Platform course 1" Add a label activity "Label 1" in section 1, setting completion to "students can manually mark this activity as complete" Click to add an activity/resource Select "Moodle LTI Advantage Tool" Click "Select content" Verify you're asked to link your tool account. Open a new tab and sign in to the tool site as the teacher 't1' In the original tab, close the modal and click "Select content" again. Proceed to link your account by clicking the "Link this account" button. Click continue and when the content selection pane loads, select all check boxes next to "Assign 1" (clicking the left box will automatically check the other) Click "Add content" Expand the "Privacy" section of the form and make sure "Share emails with the tool" and "share names with the tool" are both checked. Save the activity Repeat the process to create a resource link to "Assign 2" the same way. Verify both activities are created. Launch each activity (first launch allows the member sync to take place). On the course home, edit the "Assign 2" activity Add an access restriction based on activity completion "The activity Label 1 is marked complete" Save. Now, log out of the platform. Link level memberships check Log into the platform as student s1 Go to the course "Platform course 1" Verify you cannot access "Assign 2" Manually mark the label as complete. Verify you can now access "Assign 2" Launch "Assign 2" Verify you can view the assignment Now log out of the platform. Log in to the platform as user s2 Go to the course "Platform course 1" Manually set the label "Label 1" as complete but DO NOT launch the "Assign 2" resource. Log out of the platform. Log in to the tool as the user t1 Go to the course "Tool course 1" Go to participants Verify you see entries for users t1 and s1 from the platform, as follows: t1 will have 2 enrolment methods, one for each assignment. s1 will have 1 enrolment method listed, for Assign 2 only. Stay on this page. Now, run the member sync task via cli (in the tool site). php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members' Verify the task runs without any errors. Go back to the tool participants page and reload. Verify you now see the following enrolments: User s1 from the platform, with 2 enrolment methods "Assign 1" and "Assign 2" User s2 from the platform, with 2 enrolment methods "Assign 1" and "Assign 2" User s3 from the platform, with 1 enrolment methods "Assign 1" User s4 from the platform, with 1 enrolment methods "Assign 1" User s5 from the platform, with 1 enrolment methods "Assign 1" User t1 from the tool (remember, this user has their account linked during the content creation portion of the test), with 2 enrolment methods "Assign 1" and "Assign 2" Now, log out of the tool Log into the tool as the admin user Go to the course "Tool course 1" Open "Assign 1" and select "Locally assigned roles" from the module settings menu ("More") Verify you only see 1 entry for the teacher. Other participants won't have role assignments until they launch the resource for the first time - this is expected. Go back and open "Assign 2" and select "Locally assigned roles" from module settings now. Verify you see 2 entries: 1 for the teacher and 1 for the platform user s1. Other participants won't have role assignments until they launch the resource for the first time - this is expected. Mode "enrol and unenrol" (the default) Continuing on from above.. Now, login to the platform as teacher t1 Go to the course "Platform course 1" Enrol the user s6 as a student Unenrol user s5 Now, run the member sync task via cli (in the tool site). php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members' Verify the task runs without any errors. Go back to the tool participants page and reload. Verify : You don't see the user s5 listed any more You see user s6 listed with 1 enrolment method for "Assign 1". Mode "enrol new" Continuing on from above.. Login to the tool site as the teacher t1 Go to course "Tool course 1" Click "Published as LTI Tools" in course setting Edit the published resource "Assign 1" Expand "Remote system" and set "user sync mode" to "Enrol new users" Save Now, login to the platform as teacher t1 Go to the course "Platform course 1" Unenrol user s6 Enrol user s7 as a student Now, run the member sync task via cli. php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members' Verify the task runs without any errors. Go back to the tool participants page and reload. Verify : You still see the user s6 listed (i.e. they haven't been unenrolled) You see user s7 listed with 1 enrolment method for "Assign 1". Mode "unenrol missing" Continuing on from above.. Login to the tool site as the teacher t1 Go to course "Tool course 1" Click "Published as LTI Tools" in course setting Edit the published resource "Assign 1" Expand "Remote system" and set "user sync mode" to "Unenrol missing" Save Now, login to the platform as teacher t1 Go to the course "Platform course 1" Enrol user s8 as a student Now, run the member sync task via cli. php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members' Verify the task runs without any errors. Go back to the tool participants page and reload. Verify : You don't see user s6 listed (i.e. they have been unenrolled) You see user s7 listed with 1 enrolment method for "Assign 1" (i.e. they haven't been unenrolled) You don't see user s8 listed (i.e. they haven't been enrolled) Membership sync disabled Continuing on from above. Login to the tool site as the teacher t1 Go to course "Tool course 1" Click "Published as LTI Tools" in course setting Edit the published resource "Assign 1" Expand "Remote system" and set "User sync mode" to "Enrol new and unenrol missing users" Save Edit again and set "user synchronisation" to "No" Save again Now, run the member sync task via cli. php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members' Verify you don't see any task output mentioning syncing of memberships for resource 'Assign 1'. Go back to the tool participants page and reload. Verify : You still don't see user s8 listed (i.e. they haven't been enrolled)
    • 1
    • 4.0 Navigation blitz 3, QA blitz

    Description

      This issue deals with updating the user sync task in:
      enrol/lti/classes/task/sync_users.php

      User sync should use names and roles provisioning service 2:
      https://www.imsglobal.org/spec/lti-nrps/v2p0

      More detail will be added here as the project progresses

      Attachments

        Issue Links

          Activity

            People

              jaked Jake Dallimore
              jaked Jake Dallimore
              Mihail Geshoski Mihail Geshoski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 weeks, 6 hours, 33 minutes
                  2w 6h 33m

                  Clockify

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