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

DB authentication does not update profile fields if empty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.4
    • Authentication
    • MOODLE_34_STABLE
    • Hide

      Create an External Database to use with auth_db.

      Set up at least 1 Profile Field / User Info Field.

      Create a user in the external database with NO value in the remote user info field.

      Add a value in the external database remote user info field.

      Run sync again.

       

      Result: The new value will now appear in the users profile.

      Show
      Create an External Database to use with auth_db. Set up at least 1 Profile Field / User Info Field. Create a user in the external database with NO value in the remote user info field. Add a value in the external database remote user info field. Run sync again.   Result: The new value will now appear in the users profile.

      Example of issue:

      If Joe Bloggs has a UserInfoField of Department with the value: Computing

      and the external DB changes the department to Music it updates correctly.

       

      However if Joe Bloggs was created with an empty Department field.

      When the external DB changes the department to Music it does not update.

       

      Code at fault: 

      if (isset($user->{$key}) and $user->{$key} != $value) {
      

      Should not have the isset part as if the value is not set yet the new value needs to be set.

       

       

      Proposed solution (two options) 

      if ($user->{$key} != $value) {

      OR:

      if ((isset($user->{$key}) AND $user->{$key} != $value) OR (!isset($user->{$key}) AND isset($value)) {
      

       For Simplicity I would recommend the first option, but either would work.

            Unassigned Unassigned
            joshwillcock Josh Willcock
            Tim Hunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:

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