mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
LSsearch : Added onlyAccessible parameter
This commit is contained in:
parent
9e69912df1
commit
2d80c4a852
1 changed files with 27 additions and 3 deletions
|
@ -51,6 +51,7 @@ class LSsearch {
|
||||||
'recursive' => false,
|
'recursive' => false,
|
||||||
'attributes' => array(),
|
'attributes' => array(),
|
||||||
// Display params
|
// Display params
|
||||||
|
'onlyAccessible' => NULL,
|
||||||
'sortDirection' => NULL,
|
'sortDirection' => NULL,
|
||||||
'sortBy' => NULL,
|
'sortBy' => NULL,
|
||||||
'sortlimit' => 0,
|
'sortlimit' => 0,
|
||||||
|
@ -496,6 +497,11 @@ class LSsearch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only Accessible objects
|
||||||
|
if (isset($params['onlyAccessible'])) {
|
||||||
|
$this -> params['onlyAccessible'] = (bool)$params['onlyAccessible'];
|
||||||
|
}
|
||||||
|
|
||||||
$this -> saveParamsInSession();
|
$this -> saveParamsInSession();
|
||||||
return $OK;
|
return $OK;
|
||||||
}
|
}
|
||||||
|
@ -787,16 +793,34 @@ class LSsearch {
|
||||||
'sortBy' => NULL,
|
'sortBy' => NULL,
|
||||||
'sortDirection' => NULL
|
'sortDirection' => NULL
|
||||||
);
|
);
|
||||||
$this -> result['list'] = LSldap :: search(
|
|
||||||
|
// Search in LDAP
|
||||||
|
$list = LSldap :: search(
|
||||||
$this -> _searchParams['filter'],
|
$this -> _searchParams['filter'],
|
||||||
$this -> _searchParams['basedn'],
|
$this -> _searchParams['basedn'],
|
||||||
$this -> _searchParams
|
$this -> _searchParams
|
||||||
);
|
);
|
||||||
if ($this -> result['list'] === false) {
|
|
||||||
|
// Check result
|
||||||
|
if ($list === false) {
|
||||||
LSerror :: addErrorCode('LSsearch_12');
|
LSerror :: addErrorCode('LSsearch_12');
|
||||||
unset($this -> result['list']);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this -> getParam('onlyAccessible') && LSsession :: getLSuserObjectDn()) {
|
||||||
|
$this -> result['list']=array();
|
||||||
|
|
||||||
|
// Check user rights on objets
|
||||||
|
foreach($list as $id => $obj) {
|
||||||
|
if (LSsession :: canAccess($this -> LSobject,$obj['dn'])) {
|
||||||
|
$this -> result['list'][]=$obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this -> result['list']=$list;
|
||||||
|
}
|
||||||
|
|
||||||
$this -> addResultToCache();
|
$this -> addResultToCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue