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

View file

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

View file

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

View file

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