mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 08:19:05 +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)'),
|
'label' => _('Parrain(s)'),
|
||||||
'ldap_type' => 'ascii',
|
'ldap_type' => 'ascii',
|
||||||
'html_type' => 'select_object',
|
'html_type' => 'select_object',
|
||||||
|
'html_options' => array(
|
||||||
'selectable_object' => array(
|
'selectable_object' => array(
|
||||||
'object_type' => 'LSeepeople',
|
'object_type' => 'LSeepeople',
|
||||||
'value_attribute' => '%{dn}'
|
'value_attribute' => '%{dn}'
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'validation' => array (
|
'validation' => array (
|
||||||
array (
|
array (
|
||||||
|
|
|
@ -100,6 +100,16 @@ $GLOBALS['LSobjects']['LSeegroup'] = array (
|
||||||
'label' => _('Membres'),
|
'label' => _('Membres'),
|
||||||
'ldap_type' => 'ascii',
|
'ldap_type' => 'ascii',
|
||||||
'html_type' => 'select_object',
|
'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,
|
'required' => 0,
|
||||||
'multiple' => 1,
|
'multiple' => 1,
|
||||||
'validation' => array (
|
'validation' => array (
|
||||||
|
@ -116,14 +126,6 @@ $GLOBALS['LSobjects']['LSeegroup'] = array (
|
||||||
'form' => array (
|
'form' => array (
|
||||||
'modify' => 1,
|
'modify' => 1,
|
||||||
'create' => 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 -----------*/
|
/* ----------- end -----------*/
|
||||||
|
@ -152,10 +154,12 @@ $GLOBALS['LSobjects']['LSeegroup'] = array (
|
||||||
'label' => _('Parrain(s)'),
|
'label' => _('Parrain(s)'),
|
||||||
'ldap_type' => 'ascii',
|
'ldap_type' => 'ascii',
|
||||||
'html_type' => 'select_object',
|
'html_type' => 'select_object',
|
||||||
|
'html_options' => array (
|
||||||
'selectable_object' => array(
|
'selectable_object' => array(
|
||||||
'object_type' => 'LSeepeople',
|
'object_type' => 'LSeepeople',
|
||||||
'value_attribute' => '%{dn}'
|
'value_attribute' => '%{dn}'
|
||||||
),
|
),
|
||||||
|
),
|
||||||
'validation' => array (
|
'validation' => array (
|
||||||
array (
|
array (
|
||||||
'basedn' => '%{val}',
|
'basedn' => '%{val}',
|
||||||
|
|
|
@ -268,26 +268,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'label' => _('Groupe principal'),
|
'label' => _('Groupe principal'),
|
||||||
'ldap_type' => 'numeric',
|
'ldap_type' => 'numeric',
|
||||||
'html_type' => 'select_list',
|
'html_type' => 'select_list',
|
||||||
'multiple' => false,
|
'html_options' => array (
|
||||||
'required' => 1,
|
|
||||||
'validation' => array (
|
|
||||||
array (
|
|
||||||
'msg' => _("Ce groupe n'existe pas."),
|
|
||||||
'object_type' => 'LSeegroup', // 'object_type' : Permet definir le type d'objet recherchés
|
|
||||||
//'basedn' => 'o=company', // et d'utiliser les objectClass définis dans le fichier de configuration
|
|
||||||
'filter' => '(gidNumber=%{val})', // pour la recherche
|
|
||||||
'result' => 1
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'rights' => array(
|
|
||||||
'admin' => 'w',
|
|
||||||
'godfather' => 'r'
|
|
||||||
),
|
|
||||||
'view' => 1,
|
|
||||||
'form' => array (
|
|
||||||
'modify' => 1,
|
|
||||||
'create' => 1
|
|
||||||
),
|
|
||||||
'possible_values' => array(
|
'possible_values' => array(
|
||||||
'OTHER_OBJECT' => array(
|
'OTHER_OBJECT' => array(
|
||||||
'object_type' => 'LSeegroup', // Nom de l'objet à lister
|
'object_type' => 'LSeegroup', // Nom de l'objet à lister
|
||||||
|
@ -307,6 +288,27 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'multiple' => false,
|
||||||
|
'required' => 1,
|
||||||
|
'validation' => array (
|
||||||
|
array (
|
||||||
|
'msg' => _("Ce groupe n'existe pas."),
|
||||||
|
'object_type' => 'LSeegroup', // 'object_type' : Permet definir le type d'objet recherchés
|
||||||
|
//'basedn' => 'o=company', // et d'utiliser les objectClass définis dans le fichier de configuration
|
||||||
|
'filter' => '(gidNumber=%{val})', // pour la recherche
|
||||||
|
'result' => 1
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'rights' => array(
|
||||||
|
'admin' => 'w',
|
||||||
|
'godfather' => 'r'
|
||||||
|
),
|
||||||
|
'view' => 1,
|
||||||
|
'form' => array (
|
||||||
|
'modify' => 1,
|
||||||
|
'create' => 1
|
||||||
|
)
|
||||||
|
),
|
||||||
/* ----------- end -----------*/
|
/* ----------- end -----------*/
|
||||||
|
|
||||||
/* ----------- start -----------*/
|
/* ----------- start -----------*/
|
||||||
|
@ -314,6 +316,10 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'label' => _('Interpreteur de commande'),
|
'label' => _('Interpreteur de commande'),
|
||||||
'help_info' => _("Permet ou non a l'utilisateur de se connecter à un système POSIX."),
|
'help_info' => _("Permet ou non a l'utilisateur de se connecter à un système POSIX."),
|
||||||
'ldap_type' => 'boolean',
|
'ldap_type' => 'boolean',
|
||||||
|
'ldap_options' => array (
|
||||||
|
'true_value' => '/bin/bash',
|
||||||
|
'false_value' => '/bin/false'
|
||||||
|
),
|
||||||
'html_type' => 'boolean',
|
'html_type' => 'boolean',
|
||||||
'required' => 1,
|
'required' => 1,
|
||||||
'default_value' => 'no',
|
'default_value' => 'no',
|
||||||
|
@ -324,9 +330,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'form' => array (
|
'form' => array (
|
||||||
'modify' => 1,
|
'modify' => 1,
|
||||||
'create' => 1
|
'create' => 1
|
||||||
),
|
)
|
||||||
'true_value' => '/bin/bash',
|
|
||||||
'false_value' => '/bin/false'
|
|
||||||
),
|
),
|
||||||
/* ----------- end -----------*/
|
/* ----------- end -----------*/
|
||||||
|
|
||||||
|
@ -397,6 +401,13 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'label' => _('Titre'),
|
'label' => _('Titre'),
|
||||||
'ldap_type' => 'ascii',
|
'ldap_type' => 'ascii',
|
||||||
'html_type' => 'select_list',
|
'html_type' => 'select_list',
|
||||||
|
'html_options' => array (
|
||||||
|
'possible_values' => array(
|
||||||
|
'M.' => 'M.',
|
||||||
|
'Mme' => 'Mme',
|
||||||
|
'Mlle' => 'Mlle'
|
||||||
|
)
|
||||||
|
),
|
||||||
'required' => 1,
|
'required' => 1,
|
||||||
'default_value' => 'M.',
|
'default_value' => 'M.',
|
||||||
'rights' => array(
|
'rights' => array(
|
||||||
|
@ -409,11 +420,6 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'form' => array (
|
'form' => array (
|
||||||
'modify' => 1,
|
'modify' => 1,
|
||||||
'create' => 1
|
'create' => 1
|
||||||
),
|
|
||||||
'possible_values' => array(
|
|
||||||
'M.' => 'M.',
|
|
||||||
'Mme' => 'Mme',
|
|
||||||
'Mlle' => 'Mlle'
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
/* ----------- end -----------*/
|
/* ----------- end -----------*/
|
||||||
|
@ -576,10 +582,12 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'label' => _('Parrain(s)'),
|
'label' => _('Parrain(s)'),
|
||||||
'ldap_type' => 'ascii',
|
'ldap_type' => 'ascii',
|
||||||
'html_type' => 'select_object',
|
'html_type' => 'select_object',
|
||||||
|
'html_options' => array (
|
||||||
'selectable_object' => array(
|
'selectable_object' => array(
|
||||||
'object_type' => 'LSeepeople',
|
'object_type' => 'LSeepeople',
|
||||||
'value_attribute' => '%{dn}'
|
'value_attribute' => '%{dn}'
|
||||||
),
|
),
|
||||||
|
),
|
||||||
'validation' => array (
|
'validation' => array (
|
||||||
array (
|
array (
|
||||||
'basedn' => '%{val}',
|
'basedn' => '%{val}',
|
||||||
|
|
|
@ -72,8 +72,8 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
*/
|
*/
|
||||||
function getPossibleValues() {
|
function getPossibleValues() {
|
||||||
$retInfos = array();
|
$retInfos = array();
|
||||||
if (isset($this -> config['possible_values'])) {
|
if (isset($this -> config['html_options']['possible_values'])) {
|
||||||
foreach($this -> config['possible_values'] as $val_name => $val) {
|
foreach($this -> config['html_options']['possible_values'] as $val_name => $val) {
|
||||||
if($val_name=='OTHER_OBJECT') {
|
if($val_name=='OTHER_OBJECT') {
|
||||||
if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) {
|
if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) {
|
||||||
LSerror :: addErrorCode('LSattr_html_select_list_01',$this -> name);
|
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']();
|
$obj = new $val['object_type']();
|
||||||
if($val['scope']) {
|
if($val['scope']) {
|
||||||
$param=array('scope' => $this -> config['possible_values']['scope']);
|
$param=array('scope' => $this -> config['html_options']['possible_values']['scope']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$param=array();
|
$param=array();
|
||||||
|
@ -96,7 +96,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
$param['attributes'][] = $val['value_attribute'];
|
$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}')) {
|
if(($val['value_attribute']=='dn')||($val['value_attribute']=='%{dn}')) {
|
||||||
for($i=0;$i<count($list);$i++) {
|
for($i=0;$i<count($list);$i++) {
|
||||||
$retInfos[$list[$i]['dn']]=getFData($val['display_attribute'],$list[$i]['attrs']);
|
$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 -> setValue($values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$element -> setSelectableObject($this -> config['selectable_object']['object_type']);
|
$element -> setSelectableObject($this -> config['html_options']['selectable_object']['object_type']);
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
*/
|
*/
|
||||||
function getValuesFromFormValues($values=NULL) {
|
function getValuesFromFormValues($values=NULL) {
|
||||||
$retValues = array();
|
$retValues = array();
|
||||||
if (isset($this -> config['selectable_object'])) {
|
if (isset($this -> config['html_options']['selectable_object'])) {
|
||||||
$conf=$this -> config['selectable_object'];
|
$conf=$this -> config['html_options']['selectable_object'];
|
||||||
if (!isset($conf['object_type'])) {
|
if (!isset($conf['object_type'])) {
|
||||||
LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
|
LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
|
||||||
return;
|
return;
|
||||||
|
@ -126,8 +126,8 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
function getFormValues($values=NULL,$fromDNs=false) {
|
function getFormValues($values=NULL,$fromDNs=false) {
|
||||||
$retInfos = array();
|
$retInfos = array();
|
||||||
$DNs=array();
|
$DNs=array();
|
||||||
if (isset($this -> config['selectable_object'])) {
|
if (isset($this -> config['html_options']['selectable_object'])) {
|
||||||
$conf=$this -> config['selectable_object'];
|
$conf=$this -> config['html_options']['selectable_object'];
|
||||||
if (!isset($conf['object_type'])) {
|
if (!isset($conf['object_type'])) {
|
||||||
LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
|
LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
|
||||||
return;
|
return;
|
||||||
|
@ -184,8 +184,8 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
* le DN et en valeur ce qui sera affiché.
|
* le DN et en valeur ce qui sera affiché.
|
||||||
*/
|
*/
|
||||||
function getValuesFromSession() {
|
function getValuesFromSession() {
|
||||||
if(is_array($_SESSION['LSselect'][$this -> config['selectable_object']['object_type']])) {
|
if(is_array($_SESSION['LSselect'][$this -> config['html_options']['selectable_object']['object_type']])) {
|
||||||
return $this -> getFormValues($_SESSION['LSselect'][$this -> config['selectable_object']['object_type']],true);
|
return $this -> getFormValues($_SESSION['LSselect'][$this -> config['html_options']['selectable_object']['object_type']],true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,10 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
function getUpdateData($data) {
|
||||||
if ($data[0]=='yes') {
|
if ($data[0]=='yes') {
|
||||||
return array($this -> config['true_value']);
|
return array($this -> config['ldap_options']['true_value']);
|
||||||
}
|
}
|
||||||
if ($data[0]=='no') {
|
if ($data[0]=='no') {
|
||||||
return array($this -> config['false_value']);
|
return array($this -> config['ldap_options']['false_value']);
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
if ($data[0] == $this -> config['true_value']) {
|
if ($data[0] == $this -> config['ldap_options']['true_value']) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -86,7 +86,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
if ($data[0] == $this -> config['false_value']) {
|
if ($data[0] == $this -> config['ldap_options']['false_value']) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -141,10 +141,10 @@ class LSformElement_select_object extends LSformElement {
|
||||||
* @retval array(dn -> displayName) Les objets trouvés
|
* @retval array(dn -> displayName) Les objets trouvés
|
||||||
*/
|
*/
|
||||||
function searchAdd ($pattern) {
|
function searchAdd ($pattern) {
|
||||||
if (is_array($this -> params['selectable_object'])) {
|
if (is_array($this -> params['html_options']['selectable_object'])) {
|
||||||
if (LSsession :: loadLSobject($this -> params['selectable_object']['object_type'])) {
|
if (LSsession :: loadLSobject($this -> params['html_options']['selectable_object']['object_type'])) {
|
||||||
$obj = new $this -> params['selectable_object']['object_type']();
|
$obj = new $this -> params['html_options']['selectable_object']['object_type']();
|
||||||
$ret = $obj -> getSelectArray($pattern,NULL,$this -> params['selectable_object']['display_attribute']);
|
$ret = $obj -> getSelectArray($pattern,NULL,$this -> params['html_options']['selectable_object']['display_attribute']);
|
||||||
if (is_array($ret)) {
|
if (is_array($ret)) {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue