Line breaks and diagnostic logs
This commit is contained in:
parent
b44b6c4116
commit
0e06bf6c97
|
@ -225,7 +225,7 @@ class LDAP implements LDAPInterface
|
||||||
throw new Exception('An error has occured during ldap_first_entry execution. Please check parameter of LDAP/getData.');
|
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));
|
error_log("LDAP \$data = " . var_dump($data));
|
||||||
|
|
||||||
$mail = ldap_get_values($this->ldap_server, $data, "mail");
|
$mail = ldap_get_values($this->ldap_server, $data, "mail");
|
||||||
if (!$mail)
|
if (!$mail)
|
||||||
|
@ -239,7 +239,9 @@ class LDAP implements LDAPInterface
|
||||||
throw new Exception('An error has occured during ldap_get_values execution (complete name). Please check parameter of LDAP/getData.');
|
throw new Exception('An error has occured during ldap_get_values execution (complete name). Please check parameter of LDAP/getData.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("mail" => $mail[0], "cn" => $cn[0]);
|
$return_data = array("mail" => $mail[0], "cn" => $cn[0]);
|
||||||
|
error_log("LDAP \$return_data = " . json_encode($return_data));
|
||||||
|
return $return_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,8 +34,17 @@ try
|
||||||
{
|
{
|
||||||
$data = $ldap->getDataForMattermost($ldap_base_dn,$ldap_filter,$ldap_bind_dn,$ldap_bind_pass,$ldap_search_attribute,$user);
|
$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.
|
/* Here is the patch for Mattermost 4.4 and older. Gitlab has changed
|
||||||
error_log("resource.php \$data = " . json_encode($data);
|
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.
|
||||||
|
*/
|
||||||
|
if ($data) {
|
||||||
|
error_log("resource.php \$data = " . json_encode($data));
|
||||||
|
} else {
|
||||||
|
error_log("$data is null");
|
||||||
|
}
|
||||||
|
|
||||||
$resp = array(
|
$resp = array(
|
||||||
"id" => $assoc_id,
|
"id" => $assoc_id,
|
||||||
"name" => $data['cn'],
|
"name" => $data['cn'],
|
||||||
|
@ -70,6 +79,7 @@ try
|
||||||
"external" => false,
|
"external" => false,
|
||||||
"shared_runners_minutes_limit" => null
|
"shared_runners_minutes_limit" => null
|
||||||
);
|
);
|
||||||
|
error_log("\$resp = " . json_encode($resp));
|
||||||
|
|
||||||
// Below is the old version, still consistent with Mattermost before version 4.4
|
// 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']);
|
// $resp = array("name" => $data['cn'],"username" => $user,"id" => $assoc_id,"state" => "active","email" => $data['mail']);
|
||||||
|
|
|
@ -9,6 +9,8 @@ require_once __DIR__.'/server.php';
|
||||||
|
|
||||||
// Handle a request for an OAuth2.0 Access Token and send the response to the client
|
// Handle a request for an OAuth2.0 Access Token and send the response to the client
|
||||||
error_log("token.php \$_POST = " . json_encode($_POST));
|
error_log("token.php \$_POST = " . json_encode($_POST));
|
||||||
|
// The Mattermost server seems to be returning bare http urls, even though there is no http url in the config.json
|
||||||
|
|
||||||
if (substr($_POST["redirect_uri"],0,5) == "http:") {
|
if (substr($_POST["redirect_uri"],0,5) == "http:") {
|
||||||
$_POST["redirect_uri"] = "https" . substr($_POST["redirect_uri"],4);
|
$_POST["redirect_uri"] = "https" . substr($_POST["redirect_uri"],4);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue