From 7aa96ae60cabf96de92094903271f0aab191acf1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 23 Mar 2017 16:29:33 +0100 Subject: [PATCH] LSattr_html :: select_list / select_object : add parameter to handle onlyAccessible LSsearch parameter --- .../LSattr_html/LSattr_html_select_list.docbook | 10 +++++++++- .../LSattr_html/LSattr_html_select_object.docbook | 10 +++++++++- .../includes/class/class.LSattr_html_select_list.php | 1 + .../includes/class/class.LSattr_html_select_object.php | 4 +++- .../class/class.LSformElement_select_object.php | 4 +++- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_select_list.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_select_list.docbook index a0abe284..ae41e1d3 100644 --- a/doc/conf/LSattribute/LSattr_html/LSattr_html_select_list.docbook +++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_select_list.docbook @@ -19,7 +19,8 @@ 'values_attribute' => '[Nom de l'attribut clé multi-valeur]', 'filter' => '[Filtre de recherche des LSobject]', 'scope' => '[Scope de la recherche]', - 'basedn' => '[Basedn de la recherche]' + 'basedn' => '[Basedn de la recherche]', + 'onlyAccessible' => '[Booléen]' ), array ( 'label' => '[LSformat du nom du groupe de valeurs]', @@ -118,6 +119,13 @@ Basedn falcultatif de la recherche des LSobjets. + + + onlyAccessible + + Booléen falcultatif définissant si seul les LSobjets auxquels l'utilisateur connecté à accès doivent être considérés comme sélectionnables (Faux par défault). + + diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_select_object.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_select_object.docbook index 0fb33f1b..1f6bfb48 100644 --- a/doc/conf/LSattribute/LSattr_html/LSattr_html_select_object.docbook +++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_select_object.docbook @@ -11,7 +11,8 @@ selectable_object => array ( 'object_type' => '[Type d'LSobject selectionnable]', 'display_name_format' => '[LSformat du nom d'affichage des LSobjects]', - 'value_attribute' => '[Nom de l'attribut clé des LSobjects]' + 'value_attribute' => '[Nom de l'attribut clé des LSobjects]', + 'onlyAccessible' => '[Booléen]' ), 'ordered' => [Booléen], 'sort' => [Booléen], @@ -62,6 +63,13 @@ lors de la sélection des objets. + + + onlyAccessible + + Booléen falcultatif définissant si seul les LSobjets auxquels l'utilisateur connecté à accès doivent être considérés comme sélectionnables (Faux par défault). + + diff --git a/public_html/includes/class/class.LSattr_html_select_list.php b/public_html/includes/class/class.LSattr_html_select_list.php index f27a6ab7..7708689d 100644 --- a/public_html/includes/class/class.LSattr_html_select_list.php +++ b/public_html/includes/class/class.LSattr_html_select_list.php @@ -170,6 +170,7 @@ class LSattr_html_select_list extends LSattr_html{ 'basedn' => (isset($conf['basedn'])?$conf['basedn']:null), 'scope' => (isset($conf['scope'])?$conf['scope']:null), 'displayFormat' => (isset($conf['display_name_format'])?$conf['display_name_format']:null), + 'onlyAccessible' => (isset($conf['onlyAccessible'])?$conf['onlyAccessible']:False), ); if (isset($conf['value_attribute']) && $conf['value_attribute']!='dn') { diff --git a/public_html/includes/class/class.LSattr_html_select_object.php b/public_html/includes/class/class.LSattr_html_select_object.php index 4a942687..45ee9968 100644 --- a/public_html/includes/class/class.LSattr_html_select_object.php +++ b/public_html/includes/class/class.LSattr_html_select_object.php @@ -165,7 +165,9 @@ class LSattr_html_select_object extends LSattr_html{ foreach($values as $val) { if (!empty($val)) { $filter=Net_LDAP2_Filter::create($conf['value_attribute'],'equals',$val); - $listobj = $obj -> listObjectsName($filter,NULL,array(),$conf['display_name_format']); + $sparams=array(); + $sparams['onlyAccessible'] = (isset($conf['onlyAccessible'])?$conf['onlyAccessible']:False); + $listobj = $obj -> listObjectsName($filter,NULL,$sparams,$conf['display_name_format']); if (count($listobj)==1) { foreach($listobj as $dn => $name) { $DNs[]=$dn; diff --git a/public_html/includes/class/class.LSformElement_select_object.php b/public_html/includes/class/class.LSformElement_select_object.php index efd880d9..3f279f8c 100644 --- a/public_html/includes/class/class.LSformElement_select_object.php +++ b/public_html/includes/class/class.LSformElement_select_object.php @@ -179,7 +179,9 @@ class LSformElement_select_object extends LSformElement { if (is_array($this -> params['html_options']['selectable_object'])) { if (LSsession :: loadLSobject($this -> params['html_options']['selectable_object']['object_type'])) { $obj = new $this -> params['html_options']['selectable_object']['object_type'](); - $ret = $obj -> getSelectArray($pattern,NULL,$this -> params['html_options']['selectable_object']['display_name_format'],false,true,$this -> params['html_options']['selectable_object']['filter']); + $sparams = array(); + $sparams['onlyAccessible'] = (isset($this -> params['html_options']['selectable_object']['onlyAccessible'])?$this -> params['html_options']['selectable_object']['onlyAccessible']:FALSE); + $ret = $obj -> getSelectArray($pattern,NULL,$this -> params['html_options']['selectable_object']['display_name_format'],false,true,(isset($this -> params['html_options']['selectable_object']['filter'])?$this -> params['html_options']['selectable_object']['filter']:NULL),$sparams); if (is_array($ret)) { return $ret; }