Commit fce5c16c authored by Iñaki Arenaza's avatar Iñaki Arenaza
Browse files

Make 'Student ID' specific for the institution when using LDAP (bug #918442)



When we added the ability to map Student ID and Display from a LDAP
server, we completely forgot that the Student ID can be specific for
the institution. In fact, if we don't store the Student ID in
usr_institution we are not able to search for the user in the
institution users page using the Studend ID.

Full credit goes to Patrick Pollet for discovering the bug and
proposing a fix for it.

Change-Id: I545bbcb5addf837364ed1178be340d170d4114e3
Signed-off-by: default avatarIñaki Arenaza <iarenaza@mondragon.edu>
parent 52fe3992
......@@ -144,9 +144,24 @@ class AuthLdap extends Auth {
if (!empty($ldapdetails[$field]) && ($user->$field != $ldapdetails[$field])) {
$user->$field = $ldapdetails[$field];
set_profile_field($user->id, $field, $ldapdetails[$field]);
if (('studentid' == $field) && ('mahara' != $this->institution)) {
// studentid is specific for the institution, so store it there too.
$dataobject = array(
'usr' => $user->id,
'institution' => $this->institution,
'ctime' => db_format_timestamp(time()),
'studentid' => $user->studentid,
);
$whereobject = $dataobject;
unset($whereobject['ctime']);
unset($whereobject['studentid']);
ensure_record_exists('usr_institution', $whereobject, $dataobject);
unset($dataobject);
unset($whereobject);
}
}
}
}
}
return true;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment