diff --git a/doc/conf/LSattribute/LSattr_html.docbook b/doc/conf/LSattribute/LSattr_html.docbook
index b8eeb561..acbd15e6 100644
--- a/doc/conf/LSattribute/LSattr_html.docbook
+++ b/doc/conf/LSattribute/LSattr_html.docbook
@@ -2,7 +2,7 @@
Configuration des attributs HTML
Cette section décrit les options propres à chacun des types d'attributs HTML
supportés par &LdapSaisie;.
-
+
&conf-LSattr_html_boolean;
&conf-LSattr_html_date;
&conf-LSattr_html_image;
@@ -15,6 +15,7 @@
&conf-LSattr_html_postaladdress;
&conf-LSattr_html_pre;
&conf-LSattr_html_rss;
+ &conf-LSattr_html_sambaAcctFlags;
&conf-LSattr_html_select_box;
&conf-LSattr_html_select_list;
&conf-LSattr_html_select_object;
@@ -26,5 +27,5 @@
&conf-LSattr_html_valueWithUnit;
&conf-LSattr_html_wywiwyg;
&conf-LSattr_html_xmpp;
-
+
diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html.entities.xml b/doc/conf/LSattribute/LSattr_html/LSattr_html.entities.xml
index f6995381..7c0c8091 100644
--- a/doc/conf/LSattribute/LSattr_html/LSattr_html.entities.xml
+++ b/doc/conf/LSattribute/LSattr_html/LSattr_html.entities.xml
@@ -11,6 +11,7 @@
+
@@ -24,5 +25,6 @@
LSattr_html_jsonCompositeAttribute">
+LSattr_html_sambaAcctFlags">
LSattr_html_select_list">
LSattr_html_textarea">
diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_sambaAcctFlags.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_sambaAcctFlags.docbook
new file mode 100644
index 00000000..ea49ae05
--- /dev/null
+++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_sambaAcctFlags.docbook
@@ -0,0 +1,13 @@
+
+ LSattr_html_sambaAcctFlags
+ Ce type est prévu pour gérer l'attribut sambaAcctFlags du
+ schéma Samba, qui au travers d'une seule et unique valeur, respectant un format prévu,
+ liste l'ensemble des drapeaux actifs d'un compte Samba. Il est conçu pour être utilisé
+ conjointement avec le type d'attribut LDAP &LSattr_ldap_sambaAcctFlags;.
+
+ Ce type d'attribut est implémenté en dérivant le type
+ LSattr_html_select_box dont les valeurs possibles sont
+ pré-configurées (paramètre possible_values). Même si cela n'est pas
+ forcément utiles, les autres paramètres du type parent restent utilisables.
+
+
diff --git a/doc/conf/LSattribute/LSattr_ldap.docbook b/doc/conf/LSattribute/LSattr_ldap.docbook
index 2d35c7a4..2c0cf52e 100644
--- a/doc/conf/LSattribute/LSattr_ldap.docbook
+++ b/doc/conf/LSattribute/LSattr_ldap.docbook
@@ -2,7 +2,7 @@
Configuration des attributs LDAP
Cette section décrit les options propres à chacun des types d'attributs LDAP
supportés par &LdapSaisie;.
-
+
&conf-LSattr_ldap_ascii;
&conf-LSattr_ldap_boolean;
&conf-LSattr_ldap_compositeValueToJSON;
@@ -12,4 +12,5 @@
&conf-LSattr_ldap_numeric;
&conf-LSattr_ldap_password;
&conf-LSattr_ldap_postaladdress;
+ &conf-LSattr_ldap_sambaAcctFlags;
diff --git a/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap.entities.xml b/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap.entities.xml
index eb34e78f..e9a0636f 100644
--- a/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap.entities.xml
+++ b/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap.entities.xml
@@ -8,5 +8,7 @@
+
LSattr_ldap_date">
+LSattr_ldap_sambaAcctFlags">
diff --git a/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap_sambaAcctFlags.docbook b/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap_sambaAcctFlags.docbook
new file mode 100644
index 00000000..2a1393b0
--- /dev/null
+++ b/doc/conf/LSattribute/LSattr_ldap/LSattr_ldap_sambaAcctFlags.docbook
@@ -0,0 +1,9 @@
+
+ LSattr_ldap_sambaAcctFlags
+ Ce type est prévu pour gérer l'attribut sambaAcctFlags du
+ schéma Samba, qui au travers d'une seule et unique valeur, respectant un format prévu,
+ liste l'ensemble des drapeaux actifs d'un compte Samba. Il transforme l'unique valeur
+ de l'attribut LDAP en une liste de drapeaux actuellement activés sur le compte. Il est
+ conçu pour être utilisé conjointement avec le type d'attribut HTML
+ &LSattr_html_sambaAcctFlags;.
+
diff --git a/src/conf/LSobjects/config.LSobjects.LSpeople.php b/src/conf/LSobjects/config.LSobjects.LSpeople.php
index d8cefcdd..1015a158 100644
--- a/src/conf/LSobjects/config.LSobjects.LSpeople.php
+++ b/src/conf/LSobjects/config.LSobjects.LSpeople.php
@@ -144,6 +144,7 @@ $GLOBALS['LSobjects']['LSpeople'] = array (
'label' => 'Samba',
'args' => array (
'sambaSID',
+ 'sambaAcctFlags',
'sambaLogonTime',
'sambaLogoffTime',
'sambaKickoffTime',
@@ -701,6 +702,24 @@ $GLOBALS['LSobjects']['LSpeople'] = array (
),
/* ----------- end -----------*/
+ /* ----------- start -----------*/
+ 'sambaAcctFlags' => array (
+ 'label' => 'Samba account flags',
+ 'ldap_type' => 'sambaAcctFlags',
+ 'html_type' => 'sambaAcctFlags',
+ 'required' => 1,
+ 'default_value' => array('U'),
+ 'rights' => array(
+ 'admin' => 'w'
+ ),
+ 'view' => 1,
+ 'form' => array (
+ 'create' => 1,
+ 'modify' => 1
+ )
+ ),
+ /* ----------- end -----------*/
+
/* ----------- start -----------*/
'sambaLogonTime' => array (
'label' => 'Samba last logon time',
diff --git a/src/includes/class/class.LSattr_html_sambaAcctFlags.php b/src/includes/class/class.LSattr_html_sambaAcctFlags.php
new file mode 100644
index 00000000..a36a7854
--- /dev/null
+++ b/src/includes/class/class.LSattr_html_sambaAcctFlags.php
@@ -0,0 +1,57 @@
+
+ *
+ * @retval array Tableau associatif des valeurs possible de la liste avec en clé
+ * la valeur des balises option et en valeur ce qui sera affiché.
+ */
+ public static function _getPossibleValues($options=false, $name=false, &$ldapObject=false) {
+ $retInfos = array();
+ if (!LSsession :: loadLSclass('LSattr_ldap_sambaAcctFlags', null, true))
+ return $retInfos;
+ foreach(LSattr_ldap_sambaAcctFlags :: get_available_flags() as $group_label => $flags) {
+ $retInfos[] = array(
+ 'label' => $group_label,
+ 'possible_values' => $flags,
+ );
+ }
+ return $retInfos;
+ }
+
+}
diff --git a/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php b/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php
new file mode 100644
index 00000000..cde24f6a
--- /dev/null
+++ b/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php
@@ -0,0 +1,170 @@
+ 1) {
+ LSerror :: addErrorCode('LSattr_ldap_sambaAcctFlags_01');
+ return;
+ }
+ $value = $data[0];
+ $preg_pattern = "/^\[([ ";
+ foreach(self :: get_available_flags() as $group_label => $flags)
+ foreach($flags as $flag => $label)
+ $preg_pattern .= $flag;
+ $preg_pattern .= "]{0,16})\]$/";
+ self :: log_trace("parse($value): PREG composed pattern = '$preg_pattern'");
+ if (!preg_match($preg_pattern, $value, $m)) {
+ self :: log_error("parse($value): fail to parse value.");
+ LSerror :: addErrorCode('LSattr_ldap_sambaAcctFlags_02');
+ return;
+ }
+ $flags = array();
+ foreach(str_split($m[1]) as $flag) {
+ if ($flag == ' ')
+ continue;
+ if (in_array($flag, $flags))
+ continue;
+ $flags[] = $flag;
+ }
+ return $flags;
+ }
+
+ /**
+ * Format flags as one LDAP attribute value
+ *
+ * @param[in] $flags array of string Flags
+ *
+ * @retval array Array of LDAP attribute value
+ **/
+ public static function format_flags($flags) {
+ if (!is_array($flags))
+ $flags = array($flags);
+ foreach($flags as $flag) {
+ if (!self :: check_flag($flag)) {
+ LSerror :: addErrorCode('LSattr_ldap_sambaAcctFlags_03', $flag);
+ return;
+ }
+ }
+ // Add some space if need
+ for ($i=count($flags); $i <= 11; $i++)
+ $flags[] = ' ';
+ return array(
+ "[".implode("", $flags)."]"
+ );
+ }
+
+ /**
+ * Check if a flag is valid
+ *
+ * @param[in] $flag string The flag
+ *
+ * @retval boolean True if flag is valid, False otherwise
+ **/
+ public static function check_flag($flag) {
+ foreach(self :: get_available_flags() as $group_label => $flags)
+ if (array_key_exists($flag, $flags))
+ return true;
+ return false;
+ }
+
+ /**
+ * Get list of available flags grouped by type
+ *
+ * @return array List of available flags grouped by type
+ */
+ public static function get_available_flags() {
+ return array(
+ ___('Account types') => array(
+ 'U' => ___('Regular user account'),
+ 'W' => ___('Workstation Trust Account'),
+ 'S' => ___('Server Trust Account'),
+ 'I' => ___('Domain Trust Account'),
+ 'M' => ___('Majority Node Set (MNS) logon account'),
+ ),
+ ___('Account settings') => array(
+ 'H' => ___('Home directory required'),
+ 'N' => ___('Account without password'),
+ 'X' => ___('Password does not expire'),
+ 'D' => ___('Account disabled'),
+ 'T' => ___('Temporary duplicate of other account'),
+ 'L' => ___('Account automatically locked'),
+ ),
+ );
+ }
+
+}
+
+/**
+ * Error Codes
+ **/
+LSerror :: defineError('LSattr_ldap_sambaAcctFlags_01',
+___("LSattr_ldap_sambaAcctFlags: invalid attribute values count. This attribute type could only handle single value attribute.")
+);
+LSerror :: defineError('LSattr_ldap_sambaAcctFlags_02',
+___("LSattr_ldap_sambaAcctFlags: invalid attribute value. Fail to parse current flags set.")
+);
+LSerror :: defineError('LSattr_ldap_sambaAcctFlags_03',
+___("LSattr_ldap_sambaAcctFlags: invalid flag '%{flag}'. Can't format the LDAP attribute value.")
+);
diff --git a/src/includes/class/class.LSformElement_sambaAcctFlags.php b/src/includes/class/class.LSformElement_sambaAcctFlags.php
new file mode 100644
index 00000000..29c0c3eb
--- /dev/null
+++ b/src/includes/class/class.LSformElement_sambaAcctFlags.php
@@ -0,0 +1,47 @@
+
+ */
+
+class LSformElement_sambaAcctFlags extends LSformElement_select_box {
+
+ /**
+ * Return display data of this element
+ *
+ * This method return display data of this element
+ *
+ * @retval array
+ */
+ public function isMultiple(){
+ return true;
+ }
+
+}
diff --git a/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po b/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po
index 97503e66..e2123985 100644
--- a/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po
+++ b/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po
@@ -477,6 +477,82 @@ msgstr "Attribut"
msgid "Incorrect value"
msgstr "Valeur incorrecte"
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:134
+msgid "Account types"
+msgstr "Types de comptes"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:135
+msgid "Regular user account"
+msgstr "Compte utilisateur standard"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:136
+msgid "Workstation Trust Account"
+msgstr "Compte de poste de travail approuvé"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:137
+msgid "Server Trust Account"
+msgstr "Compte de serveur approuvé"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:138
+msgid "Domain Trust Account"
+msgstr "Compte de domaine approuvé"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:139
+msgid "Majority Node Set (MNS) logon account"
+msgstr "Compte de connexion Majority Node Set (MNS)"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:141
+msgid "Account settings"
+msgstr "Paramètres de compte"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:142
+msgid "Home directory required"
+msgstr "Dossier personnel requis"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:143
+msgid "Account without password"
+msgstr "Compte sans mot de passe"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:144
+msgid "Password does not expire"
+msgstr "Le mot de passe n'expire jamais"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:145
+msgid "Account disabled"
+msgstr "Compte désactivé"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:146
+msgid "Temporary duplicate of other account"
+msgstr "Copie temporaire d'un autre compte"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:147
+msgid "Account automatically locked"
+msgstr "Compte automatiquement bloqué"
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:158
+msgid ""
+"LSattr_ldap_sambaAcctFlags: invalid attribute values count. This attribute "
+"type could only handle single value attribute."
+msgstr ""
+"LSattr_ldap_sambaAcctFlags : nombre de valeurs de l'attribut incorrect. Ce "
+"type d'attribut ne peut gérer que des attributs mono-valués."
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:161
+msgid ""
+"LSattr_ldap_sambaAcctFlags: invalid attribute value. Fail to parse current "
+"flags set."
+msgstr ""
+"LSattr_ldap_sambaAcctFlags : valeur de l'attribut incorrect. Impossible de "
+"détecter les drapeaux actuellement définis."
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:164
+msgid ""
+"LSattr_ldap_sambaAcctFlags: invalid flag '%{flag}'. Can't format the LDAP "
+"attribute value."
+msgstr ""
+"LSattr_ldap_sambaAcctFlags : drapeau '%{flag}' invalide. Impossible de "
+"formater la valeur de l'attribut LDAP."
+
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:57
msgid "Display the full key."
msgstr "Affichier la clé en entier."
diff --git a/src/lang/fr_FR.UTF8/lang.php b/src/lang/fr_FR.UTF8/lang.php
index 2903fdf1..e648b3db 100644
--- a/src/lang/fr_FR.UTF8/lang.php
+++ b/src/lang/fr_FR.UTF8/lang.php
@@ -238,6 +238,10 @@ $GLOBALS['LSlang'] = array (
"Samba Password (NT)" =>
"Mot de passe Samba (NT)",
+# LSobjects.LSpeople.attrs.sambaAcctFlags.label
+"Samba account flags" =>
+ "Drapeaux de compte Samba",
+
# LSobjects.LSpeople.attrs.sambaKickoffTime.label
"Samba expiration time" =>
"Date d'expiration Samba",
diff --git a/src/lang/ldapsaisie.pot b/src/lang/ldapsaisie.pot
index 13e8c358..b2c259b5 100644
--- a/src/lang/ldapsaisie.pot
+++ b/src/lang/ldapsaisie.pot
@@ -396,6 +396,76 @@ msgstr ""
msgid "Incorrect value"
msgstr ""
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:134
+msgid "Account types"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:135
+msgid "Regular user account"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:136
+msgid "Workstation Trust Account"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:137
+msgid "Server Trust Account"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:138
+msgid "Domain Trust Account"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:139
+msgid "Majority Node Set (MNS) logon account"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:141
+msgid "Account settings"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:142
+msgid "Home directory required"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:143
+msgid "Account without password"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:144
+msgid "Password does not expire"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:145
+msgid "Account disabled"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:146
+msgid "Temporary duplicate of other account"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:147
+msgid "Account automatically locked"
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:158
+msgid ""
+"LSattr_ldap_sambaAcctFlags: invalid attribute values count. This attribute "
+"type could only handle single value attribute."
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:161
+msgid ""
+"LSattr_ldap_sambaAcctFlags: invalid attribute value. Fail to parse current "
+"flags set."
+msgstr ""
+
+#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_sambaAcctFlags.php:164
+msgid ""
+"LSattr_ldap_sambaAcctFlags: invalid flag '%{flag}'. Can't format the LDAP "
+"attribute value."
+msgstr ""
+
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:57
msgid "Display the full key."
msgstr ""