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

Allow to choose custom profile fields from OAuth2 field mappings (backport of MDL-61789)

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • MDL-77436-401
    • 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).
    • 1
    • Team Hedgehog 2023 Sprint 1.3, Team Hedgehog 2023 Sprint 1.4

      I am requesting a backport of this issue to Moodle 4.1 due to the fact that this is a Long Term Support version and having this option will benefit many organisations. 

      Orginal issue:
      https://tracker.moodle.org/browse/MDL-61789

            meirza.arson@moodle.com Meirza
            gemguardian Gemma Lesterhuis
            David Woloszyn David Woloszyn
            Ilya Tregubov Ilya Tregubov
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour, 1 minute
                1d 1h 1m

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