- LSldapObject : Ajout des méthodes suivantes :

-> getSubDnValue()
  -> getSubDnName()
- LSview/LSselect : utilisation de la méthode getSubDnName() plutôt que le
  code en local
- config.inc.php :
  -> Modification du paramètre ldapServer['subDn']
  -> Ajout du paramètre LSaccess pour la composition du menu hors config subDn
  -> Suppression ldapServer['LSobjets'] : suppression du pré-chargement
     (cf.ci-dessous)
- LSsession :
  -> Rédéfinition de la méthode de construction du menu de l'interface
     (bug #1665)
  -> Mise en cache de LSaccess
  -> top.tpl : le bouton de rafraichissement subDn devient un bouton de
     rafraichissement génerale de LSsession (config / LSaccess / subDn)
  -> Suppression du pré-chargement des objets et donc de la méthode
     loadLSobjects()
  -> Ajout d'une méthode in_menu() utilisé entre par la méthode canAccess()
     pour valider les accès aux objets
- create.php : Correction d'un bug de chargement d'objet.
- config.error_code.php : Correction bug encodage
- index_ajax.php :
  -> Correction de bugs de chargement d'objets
  -> Suppression du code de gestion des retours d'erreur multiplié et inutile
This commit is contained in:
Benjamin Renard 2008-06-21 16:16:15 +00:00
parent a8931db30d
commit 7f82e8eb49
9 changed files with 657 additions and 557 deletions

View file

@ -248,7 +248,7 @@ $GLOBALS['LSerror_code'] = array (
'level' => 'c'
),
1011 => array (
'msg' => _("LSsession : Vous n'êtes pas authorisé à effectuer cette action."),
'msg' => _("LSsession : Vous n'êtes pas authorisé à  effectuer cette action."),
'level' => 'c'
),
1012 => array (

View file

@ -54,10 +54,15 @@ $GLOBALS['LSconfig'] = array(
)
)
),
'cacheLSrights' => false,
'cacheLSrights' => true,
'cacheSearch' => true,
'authobject' => 'LSeepeople',
'authobject_pwdattr' => 'userPassword',
'LSaccess' => array(
'LSeepeople',
'LSeegroup',
'LSeecompany'
),
'recoverPassword' => array(
'mailAttr' => 'mail',
'recoveryHashAttr' => 'lsRecoveryHash',
@ -71,12 +76,7 @@ $GLOBALS['LSconfig'] = array(
'msg' => "Votre nouveau mot de passe : %{mdp}"
)
),
'emailSender' => 'noreply@lsexample.net',
'LSobjects' => array (
'LSeepeople',
'LSeegroup',
'LSeecompany'
)
'emailSender' => 'noreply@lsexample.net'
)
)
);

View file

@ -36,7 +36,7 @@ if($LSsession -> startLSsession()) {
if (isset($LSobject)) {
// Création d'un LSobject
if (class_exists($LSobject)) {
if ($GLOBALS['LSsession'] -> loadLSobject($LSobject)) {
if ( $GLOBALS['LSsession'] -> canCreate($LSobject) ) {
$object = new $LSobject();

View file

@ -40,6 +40,7 @@ class LSldapObject {
var $other_values=array();
var $submitError=true;
var $_whoami=NULL;
var $_subDn_value=NULL;
/**
* Constructeur
@ -929,6 +930,38 @@ class LSldapObject {
function isNew() {
return (!$this -> dn);
}
/**
* Retourne la valeur (DN) du subDn de l'objet
*
* @return string La valeur du subDn de l'object
*/
function getSubDnValue() {
if ($this -> _subDn_value) {
return $this -> _subDn_value;
}
$dn = $this -> getValue('dn');
$subDn_value='';
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
foreach ($subDnLdapServer as $subDn => $subDn_name) {
if (isCompatibleDNs($subDn,$dn)&&($subDn!=$dn)) {
$subDn_value=$subDn;
break;
}
}
$this -> _subDn_value = $subDn_value;
return $subDn_value;
}
/**
* Retourne la nom du subDn de l'objet
*
* @return string Le nom du subDn de l'object
*/
function getSubDnName() {
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
return $subDnLdapServer[$this -> getSubDnValue()];
}
}
?>

View file

@ -144,31 +144,6 @@ class LSsession {
return true;
}
/**
* Chargement des objects LdapSaisie
*
* Chargement des LSobjects contenue dans la variable
* $this -> ldapServer['LSobjects']
*
* @retval boolean true si le chargement a réussi, false sinon.
*/
function loadLSobjects() {
$this -> loadLSclass('LSldapObject');
if(!is_array($this -> ldapServer['LSobjects'])) {
$GLOBALS['LSerror'] -> addErrorCode(1001,"LSobjects['loads']");
return;
}
foreach ($this -> ldapServer['LSobjects'] as $object) {
if ( !$this -> loadLSobject($object) ) {
return;
}
}
return true;
}
/**
* Chargement d'un addons d'LdapSaisie
*
@ -245,30 +220,36 @@ class LSsession {
$this -> ldapServerId = $_SESSION['LSsession']['ldapServerId'];
$this -> tmp_file = $_SESSION['LSsession']['tmp_file'];
if ( $this -> cacheLSrights() ) {
if ( $this -> cacheLSrights() && !isset($_REQUEST['LSsession_refresh']) ) {
$this -> ldapServer = $_SESSION['LSsession']['ldapServer'];
$this -> LSrights = $_SESSION['LSsession']['LSrights'];
$this -> LSaccess = $_SESSION['LSsession']['LSaccess'];
if (!$this -> LSldapConnect())
return;
$this -> loadLSobjects();
}
else {
$this -> setLdapServer($this -> ldapServerId);
if (!$this -> LSldapConnect())
return;
$this -> loadLSobjects();
$this -> loadLSrights();
}
if ( $this -> cacheSudDn() && (!isset($_REQUEST['LSsession_topDn_refresh'])) ) {
if ( $this -> cacheSudDn() && (!isset($_REQUEST['LSsession_refresh'])) ) {
$this -> _subDnLdapServer = $_SESSION['LSsession_subDnLdapServer'];
}
$this -> loadLSobject($this -> ldapServer['authobject']);
if (!$this -> loadLSobject($this -> ldapServer['authobject'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$this -> ldapServer['authobject']);
return;
}
$this -> LSuserObject = new $this -> ldapServer['authobject']();
$this -> LSuserObject -> loadData($this -> dn);
if ( !$this -> cacheLSrights() || isset($_REQUEST['LSsession_refresh']) ) {
$this -> loadLSaccess();
}
$GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayValue());
if ($_POST['LSsession_topDn']) {
@ -293,8 +274,6 @@ class LSsession {
$this -> setLdapServer(0);
}
$this -> loadLSobjects();
// Connexion au serveur LDAP
if ($this -> LSldapConnect()) {
@ -564,9 +543,9 @@ class LSsession {
foreach($this ->ldapServer['subDn'] as $subDn_name => $subDn_config) {
if ($subDn_name == 'LSobject') {
if (is_array($subDn_config)) {
foreach($subDn_config as $LSobject_name => $LSoject_topDn) {
if ($LSoject_topDn) {
$topDn = $LSoject_topDn;
foreach($subDn_config as $LSobject_name => $LSoject_config) {
if ($LSoject_config['topDn']) {
$topDn = $LSoject_config['topDn'];
}
else {
$topDn = NULL;
@ -595,7 +574,9 @@ class LSsession {
}
}
else {
$return[$subDn_config] = $subDn_name;
if ((isCompatibleDNs($subDn_config['dn'],$this -> ldapServer['ldap_config']['basedn']))&&($subDn_config['dn']!="")) {
$return[$subDn_config['dn']] = $subDn_name;
}
}
}
if ($this -> cacheSudDn()) {
@ -616,15 +597,11 @@ class LSsession {
* @return array() Tableau des subDn trié
*/
function getSortSubDnLdapServer() {
if(isset($_SESSION['LSsession']['LSview_subDnLdapServer']) && $this -> cacheSudDn()) {
return $_SESSION['LSsession']['LSview_subDnLdapServer'];
}
$subDnLdapServer = $this -> getSubDnLdapServer();
if (!$subDnLdapServer) {
return array();
}
uksort($subDnLdapServer,"compareDn");
$_SESSION['LSsession']['LSview_subDnLdapServer']=$subDnLdapServer;
return $subDnLdapServer;
}
@ -851,7 +828,7 @@ class LSsession {
}
$GLOBALS['Smarty'] -> assign('LSsession_css',$Css_txt);
$GLOBALS['Smarty'] -> assign('LSaccess',$this -> LSaccess);
$GLOBALS['Smarty'] -> assign('LSaccess',$this -> LSaccess[$this -> topDn]);
// Niveau
$listTopDn = $this -> getSubDnLdapServer();
@ -942,26 +919,91 @@ class LSsession {
* @retval void
*/
function loadLSaccess() {
if ($this -> canAccess($this -> LSuserObject -> getType(),$this -> dn)) {
$LSaccess = array(
'SELF' => array(
'label' => _('Mon compte'),
'DNs' => $this -> dn
)
);
$LSaccess=array();
if (is_array($this -> ldapServer['subDn'])) {
foreach($this -> ldapServer['subDn'] as $name => $config) {
if ($name=='LSobject') {
if (is_array($config)) {
// Définition des subDns
foreach($config as $objectType => $objectConf) {
if ($this -> loadLSobject($objectType)) {
if ($subdnobject = new $objectType()) {
$tbl = $subdnobject -> getSelectArray();
if (is_array($tbl)) {
// Définition des accès
$access=array();
if (is_array($objectConf['LSobjects'])) {
foreach($objectConf['LSobjects'] as $type) {
if ($this -> loadLSobject($type)) {
if ($this -> canAccess($type)) {
$access[$type] = $GLOBALS['LSobjects'][$type]['label'];
}
}
else {
$LSaccess = array();
$GLOBALS['LSerror'] -> addErrorCode(1004,$type);
}
foreach ($GLOBALS['LSobjects'] as $objecttype => $objectconf) {
if ($this -> canAccess($objecttype) ) {
$LSaccess[$objecttype] = array (
'label' => $objectconf['label'],
'Dns' => 'All'
}
}
foreach($tbl as $dn => $dn_name) {
$LSaccess[$dn]=$access;
}
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$objectType);
}
}
}
}
else {
if ((isCompatibleDNs($this -> ldapServer['ldap_config']['basedn'],$config['dn']))&&($config['dn']!='')) {
$access=array();
if (is_array($config['LSobjects'])) {
foreach($config['LSobjects'] as $objectType) {
if ($this -> loadLSobject($objectType)) {
if ($this -> canAccess($objectType)) {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label'];
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
}
}
$LSaccess[$config['dn']]=$access;
}
}
}
}
else {
if(is_array($this -> ldapServer['LSaccess'])) {
$access=array();
foreach($this -> ldapServer['LSaccess'] as $objectType) {
if ($this -> loadLSobject($objectType)) {
if ($this -> canAccess($objectType)) {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label'];
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
}
$LSaccess[$this -> topDn] = $access;
}
}
foreach($LSaccess as $dn => $access) {
$LSaccess[$dn] = array_merge(
array(
'SELF' => _('Mon compte')
),
$access
);
}
}
$this -> LSaccess = $LSaccess;
$_SESSION['LSsession']['LSaccess'] = $LSaccess;
}
/**
@ -1013,10 +1055,24 @@ class LSsession {
* @retval boolean True si l'utilisateur a accès, false sinon
*/
function canAccess($LSobject,$dn=NULL,$right=NULL,$attr=NULL) {
if (!$this -> loadLSobject($LSobject))
if (!$this -> loadLSobject($LSobject)) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
return;
}
if ($dn) {
$whoami = $this -> whoami($dn);
if ($dn==$this -> LSuserObject -> getValue('dn')) {
if (!$this -> in_menu('SELF')) {
return;
}
}
else {
$obj = new $LSobject();
$obj -> dn = $dn;
if (!$this -> in_menu($LSobject,$obj -> getSubDnValue())) {
return;
}
}
}
else {
$objectdn=$GLOBALS['LSobjects'][$LSobject]['container_dn'].','.$this -> topDn;
@ -1272,7 +1328,7 @@ class LSsession {
*
* @param[in] $subDn string subDn
*
* @return string Le nom du subDn ou '' sinon
* @retval string Le nom du subDn ou '' sinon
*/
function getSubDnName($subDn=false) {
if (!$subDn) {
@ -1291,10 +1347,9 @@ class LSsession {
*
* @param[in] $type string Le type d'objet
*
* @return boolean true si le type d'objet est un subDnObject, false sinon
* @retval boolean true si le type d'objet est un subDnObject, false sinon
*/
function isSubDnLSobject($type) {
debug('seach : '.$type);
$result = false;
if (is_array($this -> ldapServer['subDn']['LSobject'])) {
foreach($this -> ldapServer['subDn']['LSobject'] as $key => $value) {
@ -1305,6 +1360,18 @@ class LSsession {
}
return $result;
}
/**
* Retourne si un type d'objet est dans le menu courant
*
* @retval boolean true si le type d'objet est dans le menu, false sinon
*/
function in_menu($LSobject,$topDn=NULL) {
if (!$topDn) {
$topDn=$this -> topDn;
}
return isset($this -> LSaccess[$topDn][$LSobject]);
}
}
?>

View file

@ -20,7 +20,6 @@ if (!isset($_ERRORS)) {
$GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']);
if ( $GLOBALS['LSsession'] -> LSldapConnect() ) {
session_start();
$GLOBALS['LSsession'] -> loadLSobjects();
$list = $GLOBALS['LSsession'] -> getSubDnLdapServerOptions($_SESSION['LSsession_topDn']);
if (is_string($list)) {
$list="<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
@ -29,15 +28,6 @@ if (!isset($_ERRORS)) {
'levelLabel' => $GLOBALS['LSsession'] -> getLevelLabel()
);
}
else if (is_array($list)){
$data = array('LSerror' => $GLOBALS['LSerror']->getErrors());
}
else {
$data = null;
}
}
else {
$data = array('LSerror' => $GLOBALS['LSerror']->getErrors());
}
}
break;
@ -47,6 +37,7 @@ if (!isset($_ERRORS)) {
switch($_REQUEST['action']) {
case 'onAddFieldBtnClick':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['img'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$object -> loadData($_REQUEST['objectdn']);
$form = $object -> getForm($_REQUEST['idform']);
@ -57,15 +48,16 @@ if (!isset($_ERRORS)) {
'img' => $_REQUEST['img'],
);
}
}
else {
$data = array('LSerror' => $GLOBALS['LSerror']->getErrors());
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'refreshField':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
//$object -> loadData($_REQUEST['objectdn']);
$form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']);
$val = $field -> getDisplay(true);
@ -74,15 +66,15 @@ if (!isset($_ERRORS)) {
'html' => $val['html']
);
}
}
else {
$data = array(
'LSerror' => $GLOBALS['LSerror']->getErrors()
);
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'generatePassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['viewBtnId'])) && (isset($_REQUEST['fieldId'])) && (isset($_REQUEST['idform'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']);
@ -94,15 +86,15 @@ if (!isset($_ERRORS)) {
'viewBtnId' => $_REQUEST['viewBtnId']
);
}
}
else {
$data = array(
'LSerror' => $GLOBALS['LSerror']->getErrors()
);
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'verifyPassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldId'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$object -> loadData($_REQUEST['objectdn']);
@ -113,6 +105,10 @@ if (!isset($_ERRORS)) {
'fieldId' => $_REQUEST['fieldId']
);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
}
break;
@ -126,6 +122,7 @@ if (!isset($_ERRORS)) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) {
$relationConf = $object->config['relations'][$conf['relationName']];
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
@ -149,6 +146,10 @@ if (!isset($_ERRORS)) {
$GLOBALS['LSerror'] -> addErrorCode(1011);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relationConf['LSobject']);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}
@ -170,6 +171,7 @@ if (!isset($_ERRORS)) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) {
$relationConf = $object->config['relations'][$conf['relationName']];
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$conf['relationName'])) {
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) {
@ -204,6 +206,10 @@ if (!isset($_ERRORS)) {
$GLOBALS['LSerror'] -> addErrorCode(1011);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relationConf['LSobject']);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}
@ -225,6 +231,7 @@ if (!isset($_ERRORS)) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) {
$relationConf = $object->config['relations'][$conf['relationName']];
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
@ -258,6 +265,10 @@ if (!isset($_ERRORS)) {
$GLOBALS['LSerror'] -> addErrorCode(1011);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relationConf['LSobject']);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}
@ -316,9 +327,6 @@ if (!isset($_ERRORS)) {
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$data = array(
'LSerror' => $GLOBALS['LSerror']->getErrors()
);
}
break;
}

View file

@ -36,8 +36,6 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],$GLOBALS['LSsession'] -> topDn)) {
@ -67,6 +65,7 @@ if($LSsession -> startLSsession()) {
$selectedTopDn = $GLOBALS['LSsession'] -> topDn;
$orderby = false;
$ordersense = 'ASC';
$subDnLdapServer = $GLOBALS['LSsession'] -> getSubDnLdapServer();
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject)));
}
@ -211,12 +210,7 @@ if($LSsession -> startLSsession()) {
$subDn_name=false;
if ($doSubDn) {
reset($subDnLdapServer);
while (!$subDn_name && next($subDnLdapServer)) {
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
$subDn_name=current($subDnLdapServer);
}
}
$subDn_name = $thisObject -> getSubDnName();
}
$objectList[]=array(

View file

@ -25,7 +25,7 @@
{if $LSsession_subDn!=""}
<form action="index.php" method='post' id='LSsession_topDn_form'>
<label>{$label_level}
<a href="index.php?LSsession_topDn_refresh"><img src='templates/images/refresh.png' alt='{$_refresh}' title='{$_refresh}' /></a>
<a href="index.php?LSsession_refresh"><img src='templates/images/refresh.png' alt='{$_refresh}' title='{$_refresh}' /></a>
<select name='LSsession_topDn' id='LSsession_topDn'>
{html_options values=$LSsession_subDn_indexes output=$LSsession_subDn_names selected=$LSsession_subDn}
</select>
@ -33,8 +33,8 @@
</form>
{/if}
<ul class='menu'>
{foreach from=$LSaccess item=item key=LSobject_type}
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{$item.label}</a></li>
{foreach from=$LSaccess item=label key=LSobject_type}
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{$label}</a></li>
{/foreach}
</ul>
</div>

View file

@ -30,6 +30,8 @@ if($LSsession -> startLSsession()) {
$LSobject = $_REQUEST['LSobject'];
$dn = $_REQUEST['dn'];
if ($GLOBALS['LSsession'] -> in_menu($LSobject)) {
if ( $LSobject == 'SELF' ) {
$LSobject = $GLOBALS['LSsession']-> LSuserObject -> getType();
$dn = $GLOBALS['LSsession']-> LSuserObject -> getValue('dn');
@ -145,8 +147,6 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
$params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params'];
@ -172,6 +172,7 @@ if($LSsession -> startLSsession()) {
$approx = false;
$orderby = false;
$ordersense = 'ASC';
$subDnLdapServer = $GLOBALS['LSsession'] -> getSubDnLdapServer();
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject)));
}
@ -292,23 +293,16 @@ if($LSsession -> startLSsession()) {
);
$list=$object -> listObjects($filter,$topDn,$params);
$nbObjects=count($list);
$searchData['LSobject_list_nbresult']=$nbObjects;
$c=0;
$nbObjects=0;
foreach($list as $thisObject) {
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$thisObject->getValue('dn'))) {
$subDn_name=false;
if ($doSubDn) {
reset($subDnLdapServer);
while (!$subDn_name && next($subDnLdapServer)) {
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
$subDn_name=current($subDnLdapServer);
$subDn_name = $thisObject -> getSubDnName();
}
}
}
$c++;
$nbObjects++;
unset($actions);
$actions[] = array(
@ -348,10 +342,10 @@ if($LSsession -> startLSsession()) {
'subDn' => $subDn_name
);
}
else {
debug($thisObject->getValue('dn'));
}
}
$searchData['LSobject_list_nbresult']=$nbObjects;
$searchData['objectList']=$objectList;
$searchData['LSview_actions'] = $LSview_actions;
if ($GLOBALS['LSsession'] -> cacheSearch()) {
@ -428,6 +422,10 @@ if($LSsession -> startLSsession()) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}