Use cn value for external id
This commit is contained in:
parent
5a388efa14
commit
b44b6c4116
|
@ -225,6 +225,8 @@ class LDAP implements LDAPInterface
|
|||
throw new Exception('An error has occured during ldap_first_entry execution. Please check parameter of LDAP/getData.');
|
||||
}
|
||||
|
||||
error_log("LDAP \$data = " . json_encode($data));
|
||||
|
||||
$mail = ldap_get_values($this->ldap_server, $data, "mail");
|
||||
if (!$mail)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,41 @@ try
|
|||
$data = $ldap->getDataForMattermost($ldap_base_dn,$ldap_filter,$ldap_bind_dn,$ldap_bind_pass,$ldap_search_attribute,$user);
|
||||
|
||||
// Here is the patch for Mattermost 4.4 and older. Gitlab has changed the JSON output of oauth service. Many data are not used by Mattermost, but there is a stack error if we delete them. That's the reason why date and many parameters are null or empty.
|
||||
$resp = array("id" => $assoc_id,"name" => $data['cn'],"username" => $user,"state" => "active","avatar_url" => "","web_url" => "","created_at" => "0000-00-00T00:00:00.000Z","bio" => null,"location" => null,"skype" => "","linkedin" => "","twitter" => "","website_url" => "","organization" => null,"last_sign_in_at" => "0000-00-00T00:00:00.000Z","confirmed_at" => "0000-00-00T00:00:00.000Z","last_activity_on" => null,"email" => $data['mail'],"theme_id" => 1,"color_scheme_id" => 1,"projects_limit" => 100000,"current_sign_in_at" => "0000-00-00T00:00:00.000Z","identities" => array(array("provider" => "ldapmain","extern_uid" => $data['dn'])),"can_create_group" => true,"can_create_project" => true,"two_factor_enabled" => false,"external" => false,"shared_runners_minutes_limit" => null);
|
||||
error_log("resource.php \$data = " . json_encode($data);
|
||||
$resp = array(
|
||||
"id" => $assoc_id,
|
||||
"name" => $data['cn'],
|
||||
"username" => $user,
|
||||
"state" => "active",
|
||||
"avatar_url" => "",
|
||||
"web_url" => "",
|
||||
"created_at" => "0000-00-00T00:00:00.000Z",
|
||||
"bio" => null,"location" => null,
|
||||
"skype" => "",
|
||||
"linkedin" => "",
|
||||
"twitter" => "",
|
||||
"website_url" => "",
|
||||
"organization" => null,
|
||||
"last_sign_in_at" => "0000-00-00T00:00:00.000Z",
|
||||
"confirmed_at" => "0000-00-00T00:00:00.000Z",
|
||||
"last_activity_on" => null,
|
||||
"email" => $data['mail'],
|
||||
"theme_id" => 1,
|
||||
"color_scheme_id" => 1,
|
||||
"projects_limit" => 100000,
|
||||
"current_sign_in_at" => "0000-00-00T00:00:00.000Z",
|
||||
"identities" => array(
|
||||
array(
|
||||
"provider" => "ldapmain",
|
||||
"extern_uid" => $data['cn']
|
||||
)
|
||||
),
|
||||
"can_create_group" => true,
|
||||
"can_create_project" => true,
|
||||
"two_factor_enabled" => false,
|
||||
"external" => false,
|
||||
"shared_runners_minutes_limit" => null
|
||||
);
|
||||
|
||||
// Below is the old version, still consistent with Mattermost before version 4.4
|
||||
// $resp = array("name" => $data['cn'],"username" => $user,"id" => $assoc_id,"state" => "active","email" => $data['mail']);
|
||||
|
|
Loading…
Reference in New Issue