Fix other problems when onlyAccessible parameter is set to True in LSobject configuration file

This commit is contained in:
Benjamin Renard 2017-03-23 15:15:31 +01:00
parent 0f1fe9a99c
commit 0df7887834
4 changed files with 15 additions and 10 deletions

View file

@ -305,7 +305,7 @@ LSerror :: defineError('SUPANN_02',
function supanGetEntiteNameById($id) {
if (LSsession::loadLSobject($GLOBALS['LS_SUPANN_LSOBJECT_ENTITE_TYPE'])) {
$e = new $GLOBALS['LS_SUPANN_LSOBJECT_ENTITE_TYPE']();
$list=$e -> listObjectsName("(supannCodeEntite=$id)",NULL,array(),$GLOBALS['LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME']);
$list=$e -> listObjectsName("(supannCodeEntite=$id)",NULL,array('onlyAccessible' => false),$GLOBALS['LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME']);
if (count($list)==1) {
return array_pop($list);
}
@ -323,7 +323,7 @@ LSerror :: defineError('SUPANN_02',
function supannValidateEntityId($id) {
if (LSsession::loadLSobject($GLOBALS['LS_SUPANN_LSOBJECT_ENTITE_TYPE'])) {
$e = new $GLOBALS['LS_SUPANN_LSOBJECT_ENTITE_TYPE']();
$list=$e -> listObjectsName("(supannCodeEntite=$id)");
$list=$e -> listObjectsName("(supannCodeEntite=$id)",NULL,array('onlyAccessible' => False));
if (count($list)==1) {
return true;
}
@ -351,6 +351,7 @@ LSerror :: defineError('SUPANN_02',
'pattern' => $pattern,
'attributes' => array('supannCodeEntite'),
'sizelimit' => 10,
'onlyAccessible' => false
)
);
$search -> run();

View file

@ -61,7 +61,7 @@ class LSauthMethod {
$this -> authData['username'],
LSsession :: getTopDn(),
(isset(LSsession :: $ldapServer['authObjectFilter'])?LSsession :: $ldapServer['authObjectFilter']:NULL),
array('withoutCache' => true)
array('withoutCache' => true, 'onlyAccessible' => false)
);
$nbresult=count($result);

View file

@ -472,7 +472,9 @@ class LSldapObject {
foreach($data as $val) {
// validation par check LDAP
if((isset($test['filter'])||isset($test['basedn']))&&(isset($test['result']))) {
$sparams=(isset($test['scope']))?array('scope' => $test['scope']):array();
$sparams=array('onlyAccessible' => False);
if (isset($test['scope']))
$sparams['scope'] = $test['scope'];
$this -> other_values['val']=$val;
// Filter from test configuration
if (isset($test['filter']) && !empty($test['filter'])) {
@ -954,8 +956,9 @@ class LSldapObject {
*
* @retval array('dn' => 'display')
*/
function getSelectArray($pattern=NULL,$topDn=NULL,$displayFormat=NULL,$approx=false,$cache=true,$filter=NULL) {
return $this -> listObjectsName($filter,$topDn,array('pattern' => $pattern),$displayFormat,$cache);
function getSelectArray($pattern=NULL,$topDn=NULL,$displayFormat=NULL,$approx=false,$cache=true,$filter=NULL,$sparams=array()) {
$sparams['pattern']=$pattern;
return $this -> listObjectsName($filter,$topDn,$sparams,$displayFormat,$cache);
}
/**
@ -1382,7 +1385,7 @@ class LSldapObject {
}
if ($val) {
$filter = Net_LDAP2_Filter::create($attr,'equals',$val);
return $this -> listObjects($filter,LSsession :: getRootDn(),array('scope' => 'sub','recursive' => true,'withoutCache'=>true));
return $this -> listObjects($filter,LSsession :: getRootDn(),array('scope' => 'sub','recursive' => true,'withoutCache'=>true, 'onlyAccessible' => false));
}
return;
}

View file

@ -670,13 +670,14 @@ class LSsession {
'equals',
$recoveryHash
);
$result = $authobject -> listObjects($filter,self :: $topDn);
$result = $authobject -> listObjects($filter,self :: $topDn,array('onlyAccessible' => false));
}
elseif (!empty($username)) {
$result = $authobject -> searchObject(
$username,
self :: $topDn,
self :: $ldapServer['authObjectFilter']
self :: $ldapServer['authObjectFilter'],
array('onlyAccessible' => false)
);
}
else {
@ -1704,7 +1705,7 @@ class LSsession {
foreach($config as $objectType => $objectConf) {
if (self :: loadLSobject($objectType)) {
if ($subdnobject = new $objectType()) {
$tbl = $subdnobject -> getSelectArray(NULL,self::getRootDn(),NULL,NULL,false);
$tbl = $subdnobject -> getSelectArray(NULL,self::getRootDn(),NULL,NULL,false,NULL,array('onlyAccessible' => False));
if (is_array($tbl)) {
// Définition des accès
$access=array();