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

Allow to choose custom profile fields from oAuth2 field mappings

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_39_STABLE, MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-61789-master
    • Hide
      1. Create a user profile field (Site administration > users > User profile fields
        1. Make the field a text input
        2. Give the field a name and short name. Other fields can have their defaults
      2. Enable OAuth2 authentication plugin (Site administration > plugins > manage authentication)
      3. Set up an OAuth2 issuer
        1. Setting up OAuth2 can be tricky, it is recommended to review the documentation here: https://docs.moodle.org/311/en/OAuth_2_services)
        2. Setup a Microsoft provider, using the guide here: https://docs.moodle.org/311/en/OAuth_2_Microsoft_service (It doesn't have to be MS, but it is one of the easier ones to setup, and it allows "localhost")
        3. When setting up the OAuth2 provider unselect the "Require email validation" checkbox. (This makes testing steps easier)
      4. Once the issuer is setup, go to the field mapping for the issuer and click the "Create new field mapping for issuer" button
      5. In the "External field name" field add a field that is being sent by the OAuth2 issuer
        • Note: Depending on what data you set on the provider side will depend on what fields you have available. In my testing I used the country field from the provider and mapped it to the custom profile field in Moodle
        • Note: Also currently in Moodle if you map a single source field from the provider to multiple Moodle fields, only the last one is applied.
      6. From the select dropdown for the "Internal field name" select the custom user profile field you created
      7. Log out as the administrator
      8. Log in with an  OAuth2 test account.
      9. Go to Profile / Edit Profile (YOu may need to log out as the test user and log back in as an administrator
      10. On the Edit profile page under the additional custom profile fields, you should see the value from the OAuth2 provider mapped.

      Please repeat the process by selecting the "Require email validation" checkbox in step 3.3. You need to set up an outgoing mail configuration to make it work. Once the user receives an email confirmation, click the URL link in the email and continue step 9.

      Lock Custom Profile Fields

      1. Edit the profile field. Set Is this field locked?  to True.
      2. Repeat step number 7
      3. Verify that the field will be populated and can not edit (disabled mode).
      Show
      Create a user profile field (Site administration > users > User profile fields Make the field a text input Give the field a name and short name. Other fields can have their defaults Enable OAuth2 authentication plugin (Site administration > plugins > manage authentication) Set up an OAuth2 issuer Setting up OAuth2 can be tricky, it is recommended to review the documentation here: https://docs.moodle.org/311/en/OAuth_2_services) Setup a Microsoft provider, using the guide here: https://docs.moodle.org/311/en/OAuth_2_Microsoft_service (It doesn't have to be MS, but it is one of the easier ones to setup, and it allows "localhost") When setting up the OAuth2 provider unselect the "Require email validation" checkbox. (This makes testing steps easier) Once the issuer is setup, go to the field mapping for the issuer and click the "Create new field mapping for issuer" button In the "External field name" field add a field that is being sent by the OAuth2 issuer Note: Depending on what data you set on the provider side will depend on what fields you have available. In my testing I used the country field from the provider and mapped it to the custom profile field in Moodle Note: Also currently in Moodle if you map a single source field from the provider to multiple Moodle fields, only the last one is applied. From the select dropdown for the "Internal field name" select the custom user profile field you created Log out as the administrator Log in with an  OAuth2 test account. Go to Profile / Edit Profile (YOu may need to log out as the test user and log back in as an administrator On the Edit profile page under the additional custom profile fields, you should see the value from the OAuth2 provider mapped. Please repeat the process by selecting the "Require email validation" checkbox in step 3.3. You need to set up an outgoing mail configuration to make it work. Once the user receives an email confirmation, click the URL link in the email and continue step 9. Lock Custom Profile Fields Edit the profile field. Set Is this field locked?   to True. Repeat step number 7 Verify that the field will be populated and can not edit (disabled mode).
    • 6
    • Team Hedgehog Sprint 1.2, Team Hedgehog Sprint 1.3, Team Hedgehog Sprint 1 review

      When mapping user attributes from auth server to moodle internal database only basic user fields can be set. There is no way to map values to custom profile fields defined by admin.

      These fields are many times meant to serve this purpose eg. hold a user's attribute synced from other system.

            Votes:
            22 Vote for this issue
            Watchers:
            39 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days, 16 minutes
                3d 16m

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