mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 14:33:49 +01:00
- LSattr_ldap_boolean : Déplacement de la configuration dans ldap_options
(Bug #1770) - LSattr_html_select_object : Déplacement de la configuration dans html_options (Bug #1768) - LSattr_html_select_list : Déplacement de la configuration dans html_options (Bug #1769)
This commit is contained in:
parent
a1c4bcbbcd
commit
6f1e2844c2
7 changed files with 74 additions and 60 deletions
|
@ -78,9 +78,11 @@ $GLOBALS['LSobjects']['LSeecompany'] = array (
|
|||
'label' => _('Parrain(s)'),
|
||||
'ldap_type' => 'ascii',
|
||||
'html_type' => 'select_object',
|
||||
'selectable_object' => array(
|
||||
'html_options' => array(
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople',
|
||||
'value_attribute' => '%{dn}'
|
||||
)
|
||||
),
|
||||
'validation' => array (
|
||||
array (
|
||||
|
|
|
@ -100,6 +100,16 @@ $GLOBALS['LSobjects']['LSeegroup'] = array (
|
|||
'label' => _('Membres'),
|
||||
'ldap_type' => 'ascii',
|
||||
'html_type' => 'select_object',
|
||||
'html_options' => array(
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople', // Nom de l'objet à lister
|
||||
'display_attribute' => '%{cn} (%{uidNumber})', // Spécifie le attributs à lister pour le choix,
|
||||
// si non définie => utilisation du 'select_display_attrs'
|
||||
// de la définition de l'objet
|
||||
|
||||
'value_attribute' => 'dn', // Spécifie le attributs dont la valeur sera retournée par
|
||||
)
|
||||
),
|
||||
'required' => 0,
|
||||
'multiple' => 1,
|
||||
'validation' => array (
|
||||
|
@ -116,14 +126,6 @@ $GLOBALS['LSobjects']['LSeegroup'] = array (
|
|||
'form' => array (
|
||||
'modify' => 1,
|
||||
'create' => 1
|
||||
),
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople', // Nom de l'objet à lister
|
||||
'display_attribute' => '%{cn} (%{uidNumber})', // Spécifie le attributs à lister pour le choix,
|
||||
// si non définie => utilisation du 'select_display_attrs'
|
||||
// de la définition de l'objet
|
||||
|
||||
'value_attribute' => 'dn', // Spécifie le attributs dont la valeur sera retournée par
|
||||
)
|
||||
),
|
||||
/* ----------- end -----------*/
|
||||
|
@ -152,9 +154,11 @@ $GLOBALS['LSobjects']['LSeegroup'] = array (
|
|||
'label' => _('Parrain(s)'),
|
||||
'ldap_type' => 'ascii',
|
||||
'html_type' => 'select_object',
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople',
|
||||
'value_attribute' => '%{dn}'
|
||||
'html_options' => array (
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople',
|
||||
'value_attribute' => '%{dn}'
|
||||
),
|
||||
),
|
||||
'validation' => array (
|
||||
array (
|
||||
|
|
|
@ -268,6 +268,26 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'label' => _('Groupe principal'),
|
||||
'ldap_type' => 'numeric',
|
||||
'html_type' => 'select_list',
|
||||
'html_options' => array (
|
||||
'possible_values' => array(
|
||||
'OTHER_OBJECT' => array(
|
||||
'object_type' => 'LSeegroup', // Nom de l'objet à lister
|
||||
'display_attribute' => '%{cn} (%{gidNumber})', // Spécifie le attributs à lister pour le choix,
|
||||
// si non définie => utilisation du 'select_display_attrs'
|
||||
// de la définition de l'objet
|
||||
|
||||
'value_attribute' => 'gidNumber', // Spécifie le attributs dont la valeur sera retournée par
|
||||
/*'filter' => // le formulaire spécifie les filtres de recherche pour
|
||||
array ( // l'établissement de la liste d'objets :
|
||||
array( // Premier filtre
|
||||
'filter' => 'cn=*a*',
|
||||
//'basedn' => 'o=company',
|
||||
'scope' => 'sub',
|
||||
)
|
||||
)*/
|
||||
)
|
||||
)
|
||||
),
|
||||
'multiple' => false,
|
||||
'required' => 1,
|
||||
'validation' => array (
|
||||
|
@ -287,24 +307,6 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'form' => array (
|
||||
'modify' => 1,
|
||||
'create' => 1
|
||||
),
|
||||
'possible_values' => array(
|
||||
'OTHER_OBJECT' => array(
|
||||
'object_type' => 'LSeegroup', // Nom de l'objet à lister
|
||||
'display_attribute' => '%{cn} (%{gidNumber})', // Spécifie le attributs à lister pour le choix,
|
||||
// si non définie => utilisation du 'select_display_attrs'
|
||||
// de la définition de l'objet
|
||||
|
||||
'value_attribute' => 'gidNumber', // Spécifie le attributs dont la valeur sera retournée par
|
||||
/*'filter' => // le formulaire spécifie les filtres de recherche pour
|
||||
array ( // l'établissement de la liste d'objets :
|
||||
array( // Premier filtre
|
||||
'filter' => 'cn=*a*',
|
||||
//'basedn' => 'o=company',
|
||||
'scope' => 'sub',
|
||||
)
|
||||
)*/
|
||||
)
|
||||
)
|
||||
),
|
||||
/* ----------- end -----------*/
|
||||
|
@ -314,6 +316,10 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'label' => _('Interpreteur de commande'),
|
||||
'help_info' => _("Permet ou non a l'utilisateur de se connecter à un système POSIX."),
|
||||
'ldap_type' => 'boolean',
|
||||
'ldap_options' => array (
|
||||
'true_value' => '/bin/bash',
|
||||
'false_value' => '/bin/false'
|
||||
),
|
||||
'html_type' => 'boolean',
|
||||
'required' => 1,
|
||||
'default_value' => 'no',
|
||||
|
@ -324,9 +330,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'form' => array (
|
||||
'modify' => 1,
|
||||
'create' => 1
|
||||
),
|
||||
'true_value' => '/bin/bash',
|
||||
'false_value' => '/bin/false'
|
||||
)
|
||||
),
|
||||
/* ----------- end -----------*/
|
||||
|
||||
|
@ -397,6 +401,13 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'label' => _('Titre'),
|
||||
'ldap_type' => 'ascii',
|
||||
'html_type' => 'select_list',
|
||||
'html_options' => array (
|
||||
'possible_values' => array(
|
||||
'M.' => 'M.',
|
||||
'Mme' => 'Mme',
|
||||
'Mlle' => 'Mlle'
|
||||
)
|
||||
),
|
||||
'required' => 1,
|
||||
'default_value' => 'M.',
|
||||
'rights' => array(
|
||||
|
@ -409,11 +420,6 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'form' => array (
|
||||
'modify' => 1,
|
||||
'create' => 1
|
||||
),
|
||||
'possible_values' => array(
|
||||
'M.' => 'M.',
|
||||
'Mme' => 'Mme',
|
||||
'Mlle' => 'Mlle'
|
||||
)
|
||||
),
|
||||
/* ----------- end -----------*/
|
||||
|
@ -576,9 +582,11 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'label' => _('Parrain(s)'),
|
||||
'ldap_type' => 'ascii',
|
||||
'html_type' => 'select_object',
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople',
|
||||
'value_attribute' => '%{dn}'
|
||||
'html_options' => array (
|
||||
'selectable_object' => array(
|
||||
'object_type' => 'LSeepeople',
|
||||
'value_attribute' => '%{dn}'
|
||||
),
|
||||
),
|
||||
'validation' => array (
|
||||
array (
|
||||
|
|
|
@ -72,8 +72,8 @@ class LSattr_html_select_list extends LSattr_html{
|
|||
*/
|
||||
function getPossibleValues() {
|
||||
$retInfos = array();
|
||||
if (isset($this -> config['possible_values'])) {
|
||||
foreach($this -> config['possible_values'] as $val_name => $val) {
|
||||
if (isset($this -> config['html_options']['possible_values'])) {
|
||||
foreach($this -> config['html_options']['possible_values'] as $val_name => $val) {
|
||||
if($val_name=='OTHER_OBJECT') {
|
||||
if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) {
|
||||
LSerror :: addErrorCode('LSattr_html_select_list_01',$this -> name);
|
||||
|
@ -84,7 +84,7 @@ class LSattr_html_select_list extends LSattr_html{
|
|||
}
|
||||
$obj = new $val['object_type']();
|
||||
if($val['scope']) {
|
||||
$param=array('scope' => $this -> config['possible_values']['scope']);
|
||||
$param=array('scope' => $this -> config['html_options']['possible_values']['scope']);
|
||||
}
|
||||
else {
|
||||
$param=array();
|
||||
|
@ -96,7 +96,7 @@ class LSattr_html_select_list extends LSattr_html{
|
|||
$param['attributes'][] = $val['value_attribute'];
|
||||
}
|
||||
|
||||
$list = $obj -> search($val['filter'],$this -> config['possible_values']['basedn'],$param);
|
||||
$list = $obj -> search($val['filter'],$this -> config['html_options']['possible_values']['basedn'],$param);
|
||||
if(($val['value_attribute']=='dn')||($val['value_attribute']=='%{dn}')) {
|
||||
for($i=0;$i<count($list);$i++) {
|
||||
$retInfos[$list[$i]['dn']]=getFData($val['display_attribute'],$list[$i]['attrs']);
|
||||
|
|
|
@ -49,7 +49,7 @@ class LSattr_html_select_object extends LSattr_html{
|
|||
$element -> setValue($values);
|
||||
}
|
||||
}
|
||||
$element -> setSelectableObject($this -> config['selectable_object']['object_type']);
|
||||
$element -> setSelectableObject($this -> config['html_options']['selectable_object']['object_type']);
|
||||
return $element;
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ class LSattr_html_select_object extends LSattr_html{
|
|||
*/
|
||||
function getValuesFromFormValues($values=NULL) {
|
||||
$retValues = array();
|
||||
if (isset($this -> config['selectable_object'])) {
|
||||
$conf=$this -> config['selectable_object'];
|
||||
if (isset($this -> config['html_options']['selectable_object'])) {
|
||||
$conf=$this -> config['html_options']['selectable_object'];
|
||||
if (!isset($conf['object_type'])) {
|
||||
LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
|
||||
return;
|
||||
|
@ -126,8 +126,8 @@ class LSattr_html_select_object extends LSattr_html{
|
|||
function getFormValues($values=NULL,$fromDNs=false) {
|
||||
$retInfos = array();
|
||||
$DNs=array();
|
||||
if (isset($this -> config['selectable_object'])) {
|
||||
$conf=$this -> config['selectable_object'];
|
||||
if (isset($this -> config['html_options']['selectable_object'])) {
|
||||
$conf=$this -> config['html_options']['selectable_object'];
|
||||
if (!isset($conf['object_type'])) {
|
||||
LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
|
||||
return;
|
||||
|
@ -184,8 +184,8 @@ class LSattr_html_select_object extends LSattr_html{
|
|||
* le DN et en valeur ce qui sera affiché.
|
||||
*/
|
||||
function getValuesFromSession() {
|
||||
if(is_array($_SESSION['LSselect'][$this -> config['selectable_object']['object_type']])) {
|
||||
return $this -> getFormValues($_SESSION['LSselect'][$this -> config['selectable_object']['object_type']],true);
|
||||
if(is_array($_SESSION['LSselect'][$this -> config['html_options']['selectable_object']['object_type']])) {
|
||||
return $this -> getFormValues($_SESSION['LSselect'][$this -> config['html_options']['selectable_object']['object_type']],true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -50,10 +50,10 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
|||
*/
|
||||
function getUpdateData($data) {
|
||||
if ($data[0]=='yes') {
|
||||
return array($this -> config['true_value']);
|
||||
return array($this -> config['ldap_options']['true_value']);
|
||||
}
|
||||
if ($data[0]=='no') {
|
||||
return array($this -> config['false_value']);
|
||||
return array($this -> config['ldap_options']['false_value']);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
|||
if (!is_array($data)) {
|
||||
$data=array($data);
|
||||
}
|
||||
if ($data[0] == $this -> config['true_value']) {
|
||||
if ($data[0] == $this -> config['ldap_options']['true_value']) {
|
||||
return true;
|
||||
}
|
||||
return;
|
||||
|
@ -86,7 +86,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
|||
if (!is_array($data)) {
|
||||
$data=array($data);
|
||||
}
|
||||
if ($data[0] == $this -> config['false_value']) {
|
||||
if ($data[0] == $this -> config['ldap_options']['false_value']) {
|
||||
return true;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -141,10 +141,10 @@ class LSformElement_select_object extends LSformElement {
|
|||
* @retval array(dn -> displayName) Les objets trouvés
|
||||
*/
|
||||
function searchAdd ($pattern) {
|
||||
if (is_array($this -> params['selectable_object'])) {
|
||||
if (LSsession :: loadLSobject($this -> params['selectable_object']['object_type'])) {
|
||||
$obj = new $this -> params['selectable_object']['object_type']();
|
||||
$ret = $obj -> getSelectArray($pattern,NULL,$this -> params['selectable_object']['display_attribute']);
|
||||
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_attribute']);
|
||||
if (is_array($ret)) {
|
||||
return $ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue