diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 41dae7a0..18f1ba54 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -1243,13 +1243,13 @@ class LSsession { * Retourne le droit de l'utilisateur à gérer la relation d'objet * * @param[in] string $dn Le DN de l'objet (le container_dn du type de l'objet par défaut) + * @param[in] string $LSobject Le type de l'objet * @param[in] string $relationName Le nom de la relation avec l'objet * @param[in] string $right Le type de droit a vérifier ('r' ou 'w') * * @retval boolean True si l'utilisateur a accès, false sinon */ - function relationCanAccess($dn,$relationName,$right=NULL) { - $LSobject=$this -> LSuserObject -> getType(); + function relationCanAccess($dn,$LSobject,$relationName,$right=NULL) { if (!isset($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName])) return; $whoami = $this -> whoami($dn); @@ -1271,12 +1271,13 @@ class LSsession { * Retourne le droit de l'utilisateur à modifier la relation d'objet * * @param[in] string $dn Le DN de l'objet (le container_dn du type de l'objet par défaut) + * @param[in] string $LSobject Le type de l'objet * @param[in] string $relationName Le nom de la relation avec l'objet * * @retval boolean True si l'utilisateur a accès, false sinon */ - function relationCanEdit($dn,$relationName) { - return $this -> relationCanAccess($dn,$relationName,'w'); + function relationCanEdit($dn,$LSobject,$relationName) { + return $this -> relationCanAccess($dn,$LSobject,$relationName,'w'); } /** diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index 6342b669..02d4832f 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -124,7 +124,7 @@ if (!isset($_ERRORS)) { 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 ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $objRel = new $relationConf['LSobject'](); $list = $objRel -> $relationConf['list_function']($object); @@ -173,7 +173,7 @@ if (!isset($_ERRORS)) { 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 ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) { if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) { $objRel = new $relationConf['LSobject'](); @@ -233,7 +233,7 @@ if (!isset($_ERRORS)) { 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 ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $objRel = new $relationConf['LSobject'](); $list = $objRel -> $relationConf['list_function']($object); diff --git a/trunk/view.php b/trunk/view.php index 1a7d8f7d..6695030f 100644 --- a/trunk/view.php +++ b/trunk/view.php @@ -82,7 +82,7 @@ if($LSsession -> startLSsession()) { if (is_array($object -> config['relations'])) { $LSrelations=array(); foreach($object -> config['relations'] as $relationName => $relationConf) { - if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$relationName)) { + if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) { $return=array( 'label' => $relationConf['label'], 'LSobject' => $relationConf['LSobject'] @@ -95,7 +95,7 @@ if($LSsession -> startLSsession()) { 'objectType' => $object -> getType(), 'objectDn' => $object -> getDn(), ); - if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$relationName)) { + if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$LSobject,$relationName)) { $return['actions'][] = array( 'label' => _('Modifier'), 'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&multiple=1',