From 9ad151312e2838ec57aa852b798f6512feda41ca Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 8 Oct 2008 14:50:48 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSsession=20::=20relationCanAcces()=20&&=20?= =?UTF-8?q?relationCanEdit()=20=09->=20Ajout=20d'un=20param=C3=A8tre=20$LS?= =?UTF-8?q?object=20au=20lieu=20de=20suppos=C3=A9=20que=20le=20type=20est?= =?UTF-8?q?=20celui=20=09=09=20de=20authUserObject=20=09->=20Modification?= =?UTF-8?q?=20en=20cons=C3=A9quence=20dans=20les=20autres=20fichiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/includes/class/class.LSsession.php | 9 +++++---- trunk/index_ajax.php | 6 +++--- trunk/view.php | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) 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',