Merged in bugfix/PMCORE-2965 (pull request #7905)
PMCORE-2965 Review the WARNING in the file workflow/engine/classes/LdapAdvanced.php Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
cc62b79f97
@@ -12,6 +12,7 @@ use ProcessMaker\Model\Groupwf;
|
|||||||
*/
|
*/
|
||||||
class LdapAdvanced
|
class LdapAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The authsource id
|
* The authsource id
|
||||||
* @var String
|
* @var String
|
||||||
@@ -783,10 +784,18 @@ class LdapAdvanced
|
|||||||
$cookie = '';
|
$cookie = '';
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
|
$searchResult = @ldap_list(
|
||||||
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["limit" => $limit]);
|
$ldapcnn,
|
||||||
|
$dn,
|
||||||
$searchResult = @ldap_list($ldapcnn, $dn, $filter, $this->arrayAttributesForUser);
|
$filter,
|
||||||
|
$this->arrayAttributesForUser,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
LDAP_DEREF_NEVER,
|
||||||
|
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
|
||||||
|
);
|
||||||
|
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
|
||||||
$this->stdLog($ldapcnn, "ldap_list", ["filter" => $filter, "attributes" => $this->arrayAttributesForUser]);
|
$this->stdLog($ldapcnn, "ldap_list", ["filter" => $filter, "attributes" => $this->arrayAttributesForUser]);
|
||||||
|
|
||||||
if ($error = ldap_errno($ldapcnn)) {
|
if ($error = ldap_errno($ldapcnn)) {
|
||||||
@@ -805,10 +814,15 @@ class LdapAdvanced
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$flagError) {
|
if (!$flagError) {
|
||||||
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
|
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
|
||||||
$this->stdLog($ldapcnn, "ldap_control_paged_result_response");
|
// You need to pass the cookie from the last call to the next one
|
||||||
|
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
|
||||||
|
} else {
|
||||||
|
$cookie = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (($cookie !== null && $cookie != '') && !$flagError);
|
// Empty cookie means last page
|
||||||
|
} while (!empty($cookie) && !$flagError);
|
||||||
|
|
||||||
//Get Users //2
|
//Get Users //2
|
||||||
if ($flagError) {
|
if ($flagError) {
|
||||||
@@ -1773,10 +1787,20 @@ class LdapAdvanced
|
|||||||
$cookie = '';
|
$cookie = '';
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
|
$searchResult = @ldap_search(
|
||||||
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["pageSize" => $limit, "isCritical" => true]);
|
$ldapcnn,
|
||||||
|
$arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||||
|
$filter,
|
||||||
|
['dn', 'ou'],
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
LDAP_DEREF_NEVER,
|
||||||
|
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
|
||||||
|
);
|
||||||
|
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
|
||||||
|
$this->stdLog($ldapcnn, "ldap_search", ["filter" => $filter, "attributes" => ['dn', 'ou']]);
|
||||||
|
|
||||||
$searchResult = @ldap_search($ldapcnn, $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], $filter, ['dn', 'ou']);
|
|
||||||
$context = [
|
$context = [
|
||||||
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||||
"filter" => $filter,
|
"filter" => $filter,
|
||||||
@@ -1832,10 +1856,15 @@ class LdapAdvanced
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$flagError) {
|
if (!$flagError) {
|
||||||
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
|
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
|
||||||
$this->stdLog($ldapcnn, "ldap_control_paged_result_response", $context);
|
// You need to pass the cookie from the last call to the next one
|
||||||
|
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
|
||||||
|
} else {
|
||||||
|
$cookie = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (($cookie !== null && $cookie != '') && !$flagError);
|
// Empty cookie means last page
|
||||||
|
} while (!empty($cookie) && !$flagError);
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
|
|
||||||
@@ -1979,6 +2008,7 @@ class LdapAdvanced
|
|||||||
|
|
||||||
return $terminated;
|
return $terminated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* activate an user previously deactivated
|
/* activate an user previously deactivated
|
||||||
if user is now in another department, we need the second parameter, the depUid
|
if user is now in another department, we need the second parameter, the depUid
|
||||||
|
|
||||||
@@ -2418,10 +2448,20 @@ class LdapAdvanced
|
|||||||
$cookie = '';
|
$cookie = '';
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
|
$searchResult = @ldap_search(
|
||||||
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["pageSize" => $limit, "isCritical" => true]);
|
$ldapcnn,
|
||||||
|
$arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||||
|
$filter,
|
||||||
|
['dn', 'cn'],
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
LDAP_DEREF_NEVER,
|
||||||
|
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
|
||||||
|
);
|
||||||
|
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
|
||||||
|
$this->stdLog($ldapcnn, "ldap_search", ["filter" => $filter, "attributes" => ['dn', 'cn']]);
|
||||||
|
|
||||||
$searchResult = @ldap_search($ldapcnn, $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], $filter, ['dn', 'cn']);
|
|
||||||
$context = [
|
$context = [
|
||||||
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||||
"filter" => $filter,
|
"filter" => $filter,
|
||||||
@@ -2459,10 +2499,15 @@ class LdapAdvanced
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$flagError) {
|
if (!$flagError) {
|
||||||
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
|
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
|
||||||
$this->stdLog($ldapcnn, "ldap_control_paged_result_response");
|
// You need to pass the cookie from the last call to the next one
|
||||||
|
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
|
||||||
|
} else {
|
||||||
|
$cookie = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (($cookie !== null && $cookie != '') && !$flagError);
|
// Empty cookie means last page
|
||||||
|
} while (!empty($cookie) && !$flagError);
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
|
|
||||||
@@ -3244,4 +3289,5 @@ class LdapAdvanced
|
|||||||
Log::channel(':ldapAdvanced')->error($message, Bootstrap::context($context));
|
Log::channel(':ldapAdvanced')->error($message, Bootstrap::context($context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user