LSsearch::getHash(): fix handling onlyAccessible parameter

This commit is contained in:
Benjamin Renard 2020-08-24 16:55:24 +02:00
parent 11c2e3c9d4
commit c4dc2a0441

View file

@ -972,10 +972,11 @@ class LSsearch extends LSlog_staticLoggerClass {
* Return an hash corresponding to the parameters of the search
*
* @param[in] $searchParams array An optional search params array
* @param[in] $onlyAccessible boolean An optional onlyAccessible boolean flag
*
* @retval string The hash of the parameters of the search
**/
public function getHash($searchParams=null) {
public function getHash($searchParams=null, $onlyAccessible=null) {
if (is_null($searchParams)) {
$searchParams = $this -> _searchParams;
}
@ -984,6 +985,11 @@ class LSsearch extends LSlog_staticLoggerClass {
if ($searchParams['filter'] instanceof Net_LDAP_Filter) {
$searchParams['filter'] = $searchParams['filter'] -> asString();
}
$to_hash = print_r($searchParams, true);
if (is_null($onlyAccessible)) {
$onlyAccessible = ($this -> getParam('onlyAccessible') && LSsession :: getLSuserObjectDn());
}
$to_hash .= '-onlyAccessible='.intval($onlyAccessible);
return hash('md5', print_r($searchParams, true));
}