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

Mapping fields that do not exist on the LDAP server causes PHP notices

XMLWordPrintable

    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-61296-master
    • Hide
      1. Setup a LDAP server and setup the LDAP authentication plugin.
        • If you don't have LDAP server you can use docker. For instance:
          1. docker run -p 389:389 --name my-openldap-container --hostname ldap.example.org --env LDAP_REPLICATION=true  --detach osixia/openldap:1.2.0
          2. docker run -p 6443:443 --name phpldapadmin-service --link my-openldap-container:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-host --detach osixia/phpldapadmin:0.7.1
          3. With this two commands you already have a nice LDAP server and PHPLdapadmin to manage. You can go to https://localhost:6443/ in your browser
            1. login: cn=admin,dc=example,dc=org
            2. password: admin
          4. Now, you can create a new user into your LDAP.
          5. In Moodle you can setup LDAP settings in http://YOURMOODLESITE/admin/settings.php?section=authsettingldap
            1. host_url: ldap://localhost:389
            2. ldap_version: 3
            3. start_tls: no
            4. bind_dn: cn=admin,dc=example,dc=org
            5. bind_pw: admin
            6. contexts: dc=example,dc=org
            7. search_sub: yes
      2. For your LDAP settings ensure you have incorrectly mapped the email address by entering a value in ‘Data mapping (Email address)’ that doesn't exist on the LDAP server and set ‘Update external (Email address)’ to ‘On update’.
        • Following the previous example you can do:
          1. field_map_email: emailwrong
          2. field_updateremote_email: On update
      3. Install https://mailcatcher.me/ or edit your config.php and add this setting:
        • $CFG->divertallemailsto = youremail;
      4. Log into your Moodle site as one of your LDAP users.
        1. Following the previous example, you have to create an account in your LDAP server. You can use http://localhost:6443/ to create a new account.
      5. Change your email in the user profile screen.
      6. View your mailcatcher UI or your inbox (usually in SPAM) if you have added $CFG->divertallemailsto.
      7. Visit the link sent to your email.
      8. Confirm: There is not PHP notices.

       

      Show
      Setup a LDAP server and setup the LDAP authentication plugin. If you don't have LDAP server you can use docker. For instance: docker run -p 389:389 --name my-openldap-container --hostname ldap.example.org --env LDAP_REPLICATION=true  --detach osixia/openldap:1.2.0 docker run -p 6443:443 --name phpldapadmin-service --link my-openldap-container:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-host --detach osixia/phpldapadmin:0.7.1 With this two commands you already have a nice LDAP server and PHPLdapadmin to manage. You can go to https://localhost:6443/  in your browser login: cn=admin,dc=example,dc=org password: admin Now, you can create a new user into your LDAP. In Moodle you can setup LDAP settings in http://YOURMOODLESITE/admin/settings.php?section=authsettingldap host_url: ldap://localhost:389 ldap_version: 3 start_tls: no bind_dn: cn=admin,dc=example,dc=org bind_pw: admin contexts: dc=example,dc=org search_sub: yes For your LDAP settings ensure you have  incorrectly  mapped the email address by entering a value in ‘Data mapping (Email address)’ that doesn't exist on the LDAP server and set ‘Update external (Email address)’ to ‘On update’. Following the previous example you can do: field_map_email: emailwrong field_updateremote_email: On update Install  https://mailcatcher.me/  or edit your config.php and add this setting: $CFG->divertallemailsto = youremail; Log into your Moodle site as one of your LDAP users. Following the previous example, you have to create an account in your LDAP server. You can use  http://localhost:6443/  to create a new account. Change your email in the user profile screen. View your mailcatcher UI or your inbox (usually in SPAM) if you have added $CFG->divertallemailsto. Visit the link sent to your email. Confirm: There is not PHP notices.  

      1. Setup a LDAP server and setup the LDAP authentication plugin.
      2. For your LDAP settings ensure you have incorrectly mapped the email address by entering a value in ‘Data mapping (Email address)’ that doesn't exist on the LDAP server and set ‘Update external (Email address)’ to ‘On update’.
      3. Install https://mailcatcher.me/
      4. Log into your Moodle site as one of your LDAP users.
      5. Change your email in the user profile screen.
      6. View your mailcatcher UI.
      7. Visit the link sent to your email.
      8. Notice PHP notices.

      Example of error - Notice: Undefined index: email in auth/ldap/auth.php on line 1295

            cescobedo Carlos Escobedo
            markn Mark Nelson
            Mark Nelson Mark Nelson
            David Monllaó David Monllaó
            Shamim Rezaie Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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