From d6893e5617e188a956affcf454feb6467865368a Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 5 Sep 2016 01:10:18 +0200 Subject: [PATCH] ajout configuration ldapsaisie --- .../config.LSobjects.cfdtApplication.php | 130 +++++++ .../config.LSobjects.cfdtFederation.php | 112 ++++++ .../LSobjects/config.LSobjects.cfdtRegion.php | 112 ++++++ .../LSobjects/config.LSobjects.cfdtRole.php | 131 +++++++ .../config.LSobjects.cfdtUtilisateur.php | 359 ++++++++++++++++++ .../conf/config.inc.example.php | 207 ++++++++++ poc-2/ldapsaisie-conf/conf/config.inc.php | 104 +++++ .../class/class.LSobjects.cfdtApplication.php | 93 +++++ .../class/class.LSobjects.cfdtFederation.php | 93 +++++ .../class/class.LSobjects.cfdtRegion.php | 93 +++++ .../class/class.LSobjects.cfdtRole.php | 93 +++++ .../class/class.LSobjects.cfdtUtilisateur.php | 6 + 12 files changed, 1533 insertions(+) create mode 100644 poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtApplication.php create mode 100644 poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtFederation.php create mode 100644 poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRegion.php create mode 100644 poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRole.php create mode 100644 poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtUtilisateur.php create mode 100644 poc-2/ldapsaisie-conf/conf/config.inc.example.php create mode 100644 poc-2/ldapsaisie-conf/conf/config.inc.php create mode 100644 poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtApplication.php create mode 100644 poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtFederation.php create mode 100644 poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRegion.php create mode 100644 poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRole.php create mode 100644 poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtUtilisateur.php diff --git a/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtApplication.php b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtApplication.php new file mode 100644 index 0000000..9746941 --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtApplication.php @@ -0,0 +1,130 @@ + array( + 'cfdtApplication' + ), + 'rdn' => 'cn', + 'container_dn' => 'ou=applications,ou=groupes', + 'label' => 'Application', + 'display_name_format' => '%{cn}', + 'displayAttrName' => true, + + 'LSform' => array ( + 'layout' => array( + 'role' => array( + 'label' => 'Rôle', + 'args' => array( + 'cn', + 'description', + 'labeledURI', + 'cfdtAuthorizedRole', + ) + ) + ) + ), // fin LSform + + // LSsearch + 'LSsearch' => array ( + 'attrs' => array( + 'cn', + ) + ), // fin LSsearch + + // Attributs + 'attrs' => array ( + /* ----------- start -----------*/ + 'cn' => array ( + 'label' => 'Identifiant', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'validation' => array ( + array ( + 'filter' => 'cn=%{val}', + 'result' => 0, + 'msg' => 'Cet identifiant est déjà utilisé.' + ) + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'description' => array ( + 'label' => 'Description/Commentaire', + 'ldap_type' => 'ascii', + 'html_type' => 'textarea', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'labeledURI' => array ( + 'label' => 'URL', + 'ldap_type' => 'ascii', + 'html_type' => 'url', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtAuthorizedRole' => array ( + 'label' => 'Membres', + 'ldap_type' => 'ascii', + 'html_type' => 'select_object', + 'html_options' => array( + 'selectable_object' => array( + 'object_type' => 'cfdtRole', // Nom de l'objet à lister + 'display_name_format' => '%{cn}', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'display_name_format' + // 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 ( + array ( + 'basedn' => '%{val}', + 'result' => 1 + ) + ), + 'view' => 1, + 'rights' => array( + 'admin' => 'w', + ), + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + + ) +); + diff --git a/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtFederation.php b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtFederation.php new file mode 100644 index 0000000..cef8653 --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtFederation.php @@ -0,0 +1,112 @@ + array( + 'cfdtFederation' + ), + 'rdn' => 'cn', + 'container_dn' => 'ou=federations,ou=groupes', + 'label' => 'Fédération', + 'display_name_format' => '%{cn}', + 'displayAttrName' => true, + + 'LSform' => array ( + 'layout' => array( + 'role' => array( + 'label' => 'Rôle', + 'args' => array( + 'cn', + 'description', + 'member', + ) + ) + ) + ), // fin LSform + + // LSsearch + 'LSsearch' => array ( + 'attrs' => array( + 'cn', + ) + ), // fin LSsearch + + // Attributs + 'attrs' => array ( + /* ----------- start -----------*/ + 'cn' => array ( + 'label' => 'Identifiant', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'validation' => array ( + array ( + 'filter' => 'cn=%{val}', + 'result' => 0, + 'msg' => 'Cet identifiant est déjà utilisé.' + ) + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'description' => array ( + 'label' => 'Description/Commentaire', + 'ldap_type' => 'ascii', + 'html_type' => 'textarea', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'member' => array ( + 'label' => 'Membres', + 'ldap_type' => 'ascii', + 'html_type' => 'select_object', + 'html_options' => array( + 'selectable_object' => array( + 'object_type' => 'cfdtUtilisateur', // Nom de l'objet à lister + 'display_name_format' => '%{givenName} %{sn} (%{uid})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'display_name_format' + // 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 ( + array ( + 'basedn' => '%{val}', + 'result' => 1 + ) + ), + 'view' => 1, + 'rights' => array( + 'admin' => 'w', + ), + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + + ) +); + diff --git a/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRegion.php b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRegion.php new file mode 100644 index 0000000..9a921ff --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRegion.php @@ -0,0 +1,112 @@ + array( + 'cfdtRegion' + ), + 'rdn' => 'cn', + 'container_dn' => 'ou=regions,ou=groupes', + 'label' => 'Région', + 'display_name_format' => '%{cn}', + 'displayAttrName' => true, + + 'LSform' => array ( + 'layout' => array( + 'role' => array( + 'label' => 'Rôle', + 'args' => array( + 'cn', + 'description', + 'member', + ) + ) + ) + ), // fin LSform + + // LSsearch + 'LSsearch' => array ( + 'attrs' => array( + 'cn', + ) + ), // fin LSsearch + + // Attributs + 'attrs' => array ( + /* ----------- start -----------*/ + 'cn' => array ( + 'label' => 'Identifiant', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'validation' => array ( + array ( + 'filter' => 'cn=%{val}', + 'result' => 0, + 'msg' => 'Cet identifiant est déjà utilisé.' + ) + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'description' => array ( + 'label' => 'Description/Commentaire', + 'ldap_type' => 'ascii', + 'html_type' => 'textarea', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'member' => array ( + 'label' => 'Membres', + 'ldap_type' => 'ascii', + 'html_type' => 'select_object', + 'html_options' => array( + 'selectable_object' => array( + 'object_type' => 'cfdtUtilisateur', // Nom de l'objet à lister + 'display_name_format' => '%{givenName} %{sn} (%{uid})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'display_name_format' + // 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 ( + array ( + 'basedn' => '%{val}', + 'result' => 1 + ) + ), + 'view' => 1, + 'rights' => array( + 'admin' => 'w', + ), + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + + ) +); + diff --git a/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRole.php b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRole.php new file mode 100644 index 0000000..e6a35bd --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtRole.php @@ -0,0 +1,131 @@ + array( + 'cfdtRole' + ), + 'rdn' => 'cn', + 'container_dn' => 'ou=roles,ou=groupes', + 'label' => 'Rôle', + 'display_name_format' => '%{cn}', + 'displayAttrName' => true, + + 'LSform' => array ( + 'layout' => array( + 'role' => array( + 'label' => 'Rôle', + 'args' => array( + 'cn', + 'description', + 'member', + ) + ) + ) + ), // fin LSform + + // LSsearch + 'LSsearch' => array ( + 'attrs' => array( + 'cn', + ) + ), // fin LSsearch + + 'LSrelation' => array( + 'applications' => array( + 'label' => 'A accès aux applications...', + 'emptyText' => "N'a accés à aucune application", + 'LSobject' => 'cfdtApplication', + 'list_function' => 'listUserGroups', + 'getkeyvalue_function' => 'getMemberKeyValue', + 'update_function' => 'updateUserGroups', + 'remove_function' => 'deleteOneMember', + 'rename_function' => 'renameOneMember', + 'canEdit_function' => 'canEditGroupRelation', + 'canEdit_attribute' => 'member', + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ) + ), + ), + + // Attributs + 'attrs' => array ( + /* ----------- start -----------*/ + 'cn' => array ( + 'label' => 'Identifiant', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'validation' => array ( + array ( + 'filter' => 'cn=%{val}', + 'result' => 0, + 'msg' => 'Cet identifiant est déjà utilisé.' + ) + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'description' => array ( + 'label' => 'Description/Commentaire', + 'ldap_type' => 'ascii', + 'html_type' => 'textarea', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'member' => array ( + 'label' => 'Membres', + 'ldap_type' => 'ascii', + 'html_type' => 'select_object', + 'html_options' => array( + 'selectable_object' => array( + 'object_type' => 'cfdtUtilisateur', // Nom de l'objet à lister + 'display_name_format' => '%{givenName} %{sn} (%{uid})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'display_name_format' + // 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 ( + array ( + 'basedn' => '%{val}', + 'result' => 1 + ) + ), + 'view' => 1, + 'rights' => array( + 'admin' => 'w', + ), + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + + ) +); + diff --git a/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtUtilisateur.php b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtUtilisateur.php new file mode 100644 index 0000000..2e64027 --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/LSobjects/config.LSobjects.cfdtUtilisateur.php @@ -0,0 +1,359 @@ + array( + 'cfdtUtilisateur' + ), + 'rdn' => 'uid', + 'container_dn' => 'ou=personnes', + 'label' => 'Utilisateur', + 'display_name_format' => '%{givenName} %{sn}', + 'displayAttrName' => true, + // LSform + 'LSform' => array ( + 'layout' => array( + 'user' => array( + 'label' => 'Utilisateur', + 'args' => array( + 'uid', + 'givenName', + 'sn', + 'cfdtNPA', + 'mail', + 'cfdtEmail', + 'cfdtIdentifiantCompteMDM', + 'cfdtUserPasswordHistorique', + 'description', + 'cfdtDateDeCreation', + 'cfdtDateDActivation', + 'cfdtUserStatus', + ) + ) + ) + ), // fin LSform + + // LSrelation + 'LSrelation' => array( + 'roles' => array( + 'label' => 'Est membre des rôles...', + 'emptyText' => "N'est membre d'aucun rôle", + 'LSobject' => 'cfdtRole', + 'list_function' => 'listUserGroups', + 'getkeyvalue_function' => 'getMemberKeyValue', + 'update_function' => 'updateUserGroups', + 'remove_function' => 'deleteOneMember', + 'rename_function' => 'renameOneMember', + 'canEdit_function' => 'canEditGroupRelation', + 'canEdit_attribute' => 'member', + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ) + ), + 'federations' => array( + 'label' => 'Est membre des fédérations...', + 'emptyText' => "N'est membre d'aucune fédération", + 'LSobject' => 'cfdtFederation', + 'list_function' => 'listUserGroups', + 'getkeyvalue_function' => 'getMemberKeyValue', + 'update_function' => 'updateUserGroups', + 'remove_function' => 'deleteOneMember', + 'rename_function' => 'renameOneMember', + 'canEdit_function' => 'canEditGroupRelation', + 'canEdit_attribute' => 'member', + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ) + ), + 'regions' => array( + 'label' => 'Est membre des régions...', + 'emptyText' => "N'est membre d'aucune région", + 'LSobject' => 'cfdtRegion', + 'list_function' => 'listUserGroups', + 'getkeyvalue_function' => 'getMemberKeyValue', + 'update_function' => 'updateUserGroups', + 'remove_function' => 'deleteOneMember', + 'rename_function' => 'renameOneMember', + 'canEdit_function' => 'canEditGroupRelation', + 'canEdit_attribute' => 'member', + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ) + ), + ), + + + // LSsearch + 'LSsearch' => array ( + 'attrs' => array( + 'givenName', + 'sn', + 'uid', + 'mail', + 'cfdtEmail', + 'cfdtNPA', + 'cfdtIdentifiantCompteMDM' + ) + ), // fin LSsearch + // Attributs + 'attrs' => array ( + /* ----------- start -----------*/ + 'uid' => array ( + 'label' => 'Identifiant', + 'help_info' => 'L\'identifiant ne doit contenir que des lettres , des chiffres, des tirets, des underscores ou des points.', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'check_data' => array ( + 'regex' => array( + 'msg' => "L'identifiant ne doit contenir que des lettres , des chiffres, des tirets, des underscores ou des points.", + 'params' => array( + 'regex' => '/^[-_.a-zA-Z0-9]+$/', + ), + ), + ), + 'validation' => array ( + array ( + 'filter' => 'uid=%{val}', + 'result' => 0, + 'msg' => 'Cet identifiant est déjà utilisé.' + ) + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'userPassword' => array ( + 'label' => 'Password', + 'help_info' => 'Le mot de passe doit faire plus de 8 caractères.', + 'ldap_type' => 'password', + 'html_type' => 'password', + 'html_options' => array( + 'generationTool' => true, + 'autoGenerate' => false, + 'lenght' => 8, + 'chars' => array ( + array ( + 'chars' => '23456789abcdefjkpqrstwxyzABCDEFJKPQRSTWXYZ', + 'nb' => 6 + ) + ), + ), + 'check_data' => array( + 'password' => array( + 'msg' => 'Le mot de passe doit faire plus de 8 caractères.', + 'params' => array( + 'minLength' => 8, + ) + ) + ), + 'required' => 1, + 'rights' => array( + 'self' => 'w', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1, + 'lostPassword' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'givenName' => array ( + 'label' => 'Prénom', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ + 'sn' => array ( + 'label' => 'Nom', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtNPA' => array ( + 'label' => 'Identifiant CFDT', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'mail' => array ( + 'label' => 'E-mail', + 'ldap_type' => 'ascii', + 'html_type' => 'mail', + 'check_data' => array ( + 'email' => array( + 'msg' => "Cette adresse est invalide.", + ), + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtEmail' => array ( + 'label' => 'E-mail CFDT', + 'ldap_type' => 'ascii', + 'html_type' => 'mail', + 'check_data' => array ( + 'email' => array( + 'msg' => "Cette adresse est invalide.", + ), + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtIdentifiantCompteMDM' => array ( + 'label' => 'Identifiant MDM', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'description' => array ( + 'label' => 'Description/Commentaire', + 'ldap_type' => 'ascii', + 'html_type' => 'textarea', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtDateDeCreation' => array ( + 'label' => 'Date de création', + 'ldap_type' => 'date', + 'html_type' => 'date', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtDateDActivation' => array ( + 'label' => 'Date d\'activation', + 'ldap_type' => 'date', + 'html_type' => 'date', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + /* ----------- start -----------*/ + 'cfdtUserStatus' => array ( + 'label' => 'Statut', + 'ldap_type' => 'ascii', + 'html_type' => 'select_box', + 'html_options' => array( + 'possibles_values' => array( + 'statut1', + 'statut2', + 'statut3', + ) + ), + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w' + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + ) +); diff --git a/poc-2/ldapsaisie-conf/conf/config.inc.example.php b/poc-2/ldapsaisie-conf/conf/config.inc.example.php new file mode 100644 index 0000000..7d07161 --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/config.inc.example.php @@ -0,0 +1,207 @@ + '/usr/share/php/Net/LDAP2.php', + 'Smarty' => '/usr/share/php/smarty3/Smarty.class.php', + 'lang' => 'fr_FR', + 'encoding' => 'UTF8', + 'cacheLSprofiles' => true, + 'cacheSubDn' => true, + 'cacheSearch' => true, + 'keepLSsessionActive' => true, + 'ldap_servers' => array ( + array ( + 'name' => 'LSexample', + 'ldap_config'=> array( + 'host' => '127.0.0.1', + 'port' => 389, + 'version' => 3, + 'starttls' => false, + 'binddn' => 'uid=ldapsaisie,ou=sysaccounts,o=ls', + 'bindpw' => 'toto', + 'basedn' => 'o=ls', + 'options' => array(), + 'filter' => '(objectClass=*)', + 'scope' => 'sub' + ), +/* + 'LSauth' => array ( + 'method' => 'HTTP' + ), +*/ + 'LSprofiles' => array ( + 'admin' => array ( + 'o=ls' => array ( + 'uid=eeggs,ou=people,o=ls' => NULL + ), + 'ou=people,o=ls' => array ( + 'cn=adminldap,ou=groups,o=ls' => array ( + 'attr' => 'uniqueMember', + 'LSobject' => 'LSgroup' + ) + ) + ), + 'godfather' => array ( + 'LSobjects' => array ( + 'LSpeople' => array ( + 'attr' => 'lsGodfatherDn', + 'attr_value' => '%{dn}', + 'basedn' => 'ou=people,o=ls' + ), + 'LSgroup' => array ( + 'filter' => '(lsGodfatherDn=%{dn})' + ) + ) + ) + ), + 'cacheLSprofiles' => true, + 'cacheSearch' => true, + 'authObjectType' => 'LSpeople', + 'authObjectFilter' => '(|(uid=%{user})(mail=%{user}))', + 'authObjectTypeAttrPwd' => 'userPassword', + 'LSaccess' => array( + 'LSpeople', + 'LSgroup' + ), + 'recoverPassword' => array( + 'mailAttr' => 'mail', + 'recoveryHashAttr' => 'lsRecoveryHash', + 'recoveryEmailSender' => 'noreply-recover@ls.com', + 'recoveryHashMail' => array( + 'subject' => 'LSexample : Recovering your password.', + 'msg' => "To proceed password recovery procedure, please follow that link:\n%{url}" + ), + 'newPasswordMail' => array( + 'subject' => 'LSexample : Your new credentials.', + 'msg' => "Your new password : %{mdp}" + ) + ), + 'emailSender' => 'noreply@ls.com' + ), + array ( + 'name' => 'LSexample - multi-company', + 'ldap_config'=> array( + 'host' => '127.0.0.1', + 'port' => 389, + 'version' => 3, + 'starttls' => false, + 'binddn' => 'uid=ldapsaisie,ou=sysaccounts,o=ls', + 'bindpw' => 'toto', + 'basedn' => 'o=ls', + 'options' => array(), + 'filter' => '(objectClass=*)', + 'scope' => 'sub' + ), + 'LSprofiles' => array( + 'admin' => array ( + 'o=ls' => array ( + 'uid=eeggs,ou=people,o=ls' => NULL, + 'cn=adminldap,ou=groups,o=ls' => array ( + 'attr' => 'uniqueMember', + 'LSobject' => 'LSgroup' + ) + ) + ), + 'admingroup' => array ( + 'ou=company1,ou=companies,o=ls' => array ( + 'uid=user1,ou=people,ou=company1,ou=companies,o=ls' => NULL + ) + ) + ), + 'authObjectType' => 'LSpeople', + 'subDnLabel' => 'Company', + 'subDn' => array( + '== All ==' => array( + 'dn' => 'o=ls', + 'LSobjects' => array( + 'LSpeople', + 'LSgroup', + 'LScompany' + ) + ), + 'LSobject' => array( + 'LScompany' => array( + 'LSobjects' => array( + 'LSpeople', + 'LSgroup' + ) + ) + ) + ), + 'cacheLSprofiles' => true, + 'cacheSearch' => true, + 'authObjectTypeAttrPwd' => 'userPassword', + 'recoverPassword' => array( + 'mailAttr' => 'mail', + 'recoveryHashAttr' => 'lsRecoveryHash', + 'recoveryEmailSender' => 'noreply-recover@lsexample.net', + 'recoveryHashMail' => array( + 'subject' => 'LSexample : Recovering your password.', + 'msg' => "To proceed password recovery procedure, please follow that link:\n%{url}" + ), + 'newPasswordMail' => array( + 'subject' => 'LSexample : Your new credentials.', + 'msg' => "Your new password : %{mdp}" + ) + ), + 'emailSender' => 'noreply@lsexample.net' + ) + ) +); + +// Interface +// Theme Black +//define('LS_THEME','black'); +//define('LS_TEMPLATES_DIR', 'templates/default'); + +// Theme Default +define('LS_THEME','default'); +define('LS_TEMPLATES_DIR', 'templates'); +define('LS_IMAGES_DIR', 'images'); +define('LS_CSS_DIR', 'css'); + +//Debug +define('LSdebug',false); + +// Logs +$GLOBALS['LSlog']['filename'] = '/var/log/ldapsaisie/ldapsaisie.log'; +$GLOBALS['LSlog']['enable'] = true; + +define('NB_LSOBJECT_LIST',20); +define('NB_LSOBJECT_LIST_SELECT',11); + +define('MAX_SEND_FILE_SIZE',2000000); + + +// Javascript +$GLOBALS['defaultJSscipts']=array( + 'mootools-core.js', + 'mootools-more.js', + 'functions.js', + 'LSdefault.js', + 'LSinfosBox.js' +); + +// CSS +$GLOBALS['defaultCSSfiles']=array(); diff --git a/poc-2/ldapsaisie-conf/conf/config.inc.php b/poc-2/ldapsaisie-conf/conf/config.inc.php new file mode 100644 index 0000000..54f39d2 --- /dev/null +++ b/poc-2/ldapsaisie-conf/conf/config.inc.php @@ -0,0 +1,104 @@ + '/usr/share/php/Net/LDAP2.php', + 'Smarty' => '/usr/share/php/smarty3/Smarty.class.php', + 'lang' => 'fr_FR', + 'encoding' => 'UTF8', + 'cacheLSprofiles' => true, + 'cacheSubDn' => true, + 'cacheSearch' => false, + 'keepLSsessionActive' => true, + 'ldap_servers' => array ( + array ( + 'name' => 'LSexample', + 'ldap_config'=> array( + 'host' => '127.0.0.1', + 'port' => 389, + 'version' => 3, + 'starttls' => false, + 'binddn' => 'cn=admin,dc=cfdt,dc=fr', + 'bindpw' => 'FIXME', + 'basedn' => 'dc=cfdt,dc=fr', + 'options' => array(), + 'filter' => '(objectClass=*)', + 'scope' => 'sub' + ), + 'LSprofiles' => array ( + 'admin' => array( + 'dc=cfdt,dc=fr' => 'uid=admin,ou=personnes,dc=cfdt,dc=fr', + ) + ), + 'cacheLSprofiles' => true, + 'cacheSearch' => true, + 'authObjectType' => 'cfdtUtilisateur', + 'authObjectFilter' => '(|(uid=%{user})(cfdtEmail=%{user})(mail=%{user}))', + 'authObjectTypeAttrPwd' => 'userPassword', + 'LSaccess' => array( + 'cfdtUtilisateur', + 'cfdtRole', + 'cfdtApplication', + 'cfdtFederation', + 'cfdtRegion', + ), + 'emailSender' => 'noreply@cfdt.fr' + ), + ) +); + +// Interface +// Theme Black +//define('LS_THEME','black'); +//define('LS_TEMPLATES_DIR', 'templates/default'); + +// Theme Default +define('LS_THEME','default'); +define('LS_TEMPLATES_DIR', 'templates'); +define('LS_IMAGES_DIR', 'images'); +define('LS_CSS_DIR', 'css'); + +//Debug +define('LSdebug',false); + +// Logs +$GLOBALS['LSlog']['filename'] = '/var/log/ldapsaisie/ldapsaisie.log'; +$GLOBALS['LSlog']['enable'] = true; + +define('NB_LSOBJECT_LIST',20); +define('NB_LSOBJECT_LIST_SELECT',11); + +define('MAX_SEND_FILE_SIZE',2000000); + + +// Javascript +$GLOBALS['defaultJSscipts']=array( + 'mootools-core.js', + 'mootools-more.js', + 'functions.js', + 'LSdefault.js', + 'LSinfosBox.js' +); + +// CSS +$GLOBALS['defaultCSSfiles']=array(); diff --git a/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtApplication.php b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtApplication.php new file mode 100644 index 0000000..013b2d3 --- /dev/null +++ b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtApplication.php @@ -0,0 +1,93 @@ + getObjectKeyValueInRelation($object,$this -> memberAttr,$this -> userObjectType); + } + + /** + * Retourne la liste des groupes pour utilisateur + * + * Retourne un tableau de LSsupannGroup correspondant aux groupes + * auxquels appartient un utilisateur + * + * @param[in] $userObject Un object user (type : $this -> userObjectType) + * + * @retval Array of LSsupannGroup Les groupes de l'utilisateur + **/ + function listUserGroups($userObject) { + return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Ajoute un utilisateur au groupe + * + * @param[in] $object Un object user ($this -> userObjectType) : l'utilisateur à ajouter + * + * @retval boolean true si l'utilisateur à été ajouté, False sinon + **/ + function addOneMember($object) { + return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Supprime un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à supprimer + * + * @retval boolean true si l'utilisateur à été supprimé, False sinon + **/ + function deleteOneMember($object) { + return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Renome un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à renomer + * @param[in] $oldDn string L'ancien DN de l'utilisateur + * + * @retval boolean True en cas de succès, False sinon + */ + function renameOneMember($object,$oldDn) { + return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Met à jour les groupes d'un utilisateur + * + * @param[in] $object Mixed Un object (type : $this -> userObjectType) : l'utilisateur + * @param[in] $listDns Array(string) Un tableau des DNs des groupes de l'utilisateur + * + * @retval boolean true si tout c'est bien passé, False sinon + **/ + function updateUserGroups($object,$listDns) { + return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Test si l'utilisateur peut d'editer la relation avec ce groupe + * + * @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon + **/ + function canEditGroupRelation($dn=NULL) { + if (!$dn) { + $dn=$this -> dn; + } + return LSsession :: canEdit($this -> type_name,$this -> dn,$this -> memberAttr); + } +} + +?> diff --git a/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtFederation.php b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtFederation.php new file mode 100644 index 0000000..20d8b8b --- /dev/null +++ b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtFederation.php @@ -0,0 +1,93 @@ + getObjectKeyValueInRelation($object,$this -> memberAttr,$this -> userObjectType); + } + + /** + * Retourne la liste des groupes pour utilisateur + * + * Retourne un tableau de LSsupannGroup correspondant aux groupes + * auxquels appartient un utilisateur + * + * @param[in] $userObject Un object user (type : $this -> userObjectType) + * + * @retval Array of LSsupannGroup Les groupes de l'utilisateur + **/ + function listUserGroups($userObject) { + return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Ajoute un utilisateur au groupe + * + * @param[in] $object Un object user ($this -> userObjectType) : l'utilisateur à ajouter + * + * @retval boolean true si l'utilisateur à été ajouté, False sinon + **/ + function addOneMember($object) { + return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Supprime un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à supprimer + * + * @retval boolean true si l'utilisateur à été supprimé, False sinon + **/ + function deleteOneMember($object) { + return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Renome un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à renomer + * @param[in] $oldDn string L'ancien DN de l'utilisateur + * + * @retval boolean True en cas de succès, False sinon + */ + function renameOneMember($object,$oldDn) { + return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Met à jour les groupes d'un utilisateur + * + * @param[in] $object Mixed Un object (type : $this -> userObjectType) : l'utilisateur + * @param[in] $listDns Array(string) Un tableau des DNs des groupes de l'utilisateur + * + * @retval boolean true si tout c'est bien passé, False sinon + **/ + function updateUserGroups($object,$listDns) { + return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Test si l'utilisateur peut d'editer la relation avec ce groupe + * + * @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon + **/ + function canEditGroupRelation($dn=NULL) { + if (!$dn) { + $dn=$this -> dn; + } + return LSsession :: canEdit($this -> type_name,$this -> dn,$this -> memberAttr); + } +} + +?> diff --git a/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRegion.php b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRegion.php new file mode 100644 index 0000000..0dc5282 --- /dev/null +++ b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRegion.php @@ -0,0 +1,93 @@ + getObjectKeyValueInRelation($object,$this -> memberAttr,$this -> userObjectType); + } + + /** + * Retourne la liste des groupes pour utilisateur + * + * Retourne un tableau de LSsupannGroup correspondant aux groupes + * auxquels appartient un utilisateur + * + * @param[in] $userObject Un object user (type : $this -> userObjectType) + * + * @retval Array of LSsupannGroup Les groupes de l'utilisateur + **/ + function listUserGroups($userObject) { + return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Ajoute un utilisateur au groupe + * + * @param[in] $object Un object user ($this -> userObjectType) : l'utilisateur à ajouter + * + * @retval boolean true si l'utilisateur à été ajouté, False sinon + **/ + function addOneMember($object) { + return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Supprime un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à supprimer + * + * @retval boolean true si l'utilisateur à été supprimé, False sinon + **/ + function deleteOneMember($object) { + return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Renome un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à renomer + * @param[in] $oldDn string L'ancien DN de l'utilisateur + * + * @retval boolean True en cas de succès, False sinon + */ + function renameOneMember($object,$oldDn) { + return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Met à jour les groupes d'un utilisateur + * + * @param[in] $object Mixed Un object (type : $this -> userObjectType) : l'utilisateur + * @param[in] $listDns Array(string) Un tableau des DNs des groupes de l'utilisateur + * + * @retval boolean true si tout c'est bien passé, False sinon + **/ + function updateUserGroups($object,$listDns) { + return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Test si l'utilisateur peut d'editer la relation avec ce groupe + * + * @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon + **/ + function canEditGroupRelation($dn=NULL) { + if (!$dn) { + $dn=$this -> dn; + } + return LSsession :: canEdit($this -> type_name,$this -> dn,$this -> memberAttr); + } +} + +?> diff --git a/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRole.php b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRole.php new file mode 100644 index 0000000..fbf5d27 --- /dev/null +++ b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtRole.php @@ -0,0 +1,93 @@ + getObjectKeyValueInRelation($object,$this -> memberAttr,$this -> userObjectType); + } + + /** + * Retourne la liste des groupes pour utilisateur + * + * Retourne un tableau de LSsupannGroup correspondant aux groupes + * auxquels appartient un utilisateur + * + * @param[in] $userObject Un object user (type : $this -> userObjectType) + * + * @retval Array of LSsupannGroup Les groupes de l'utilisateur + **/ + function listUserGroups($userObject) { + return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Ajoute un utilisateur au groupe + * + * @param[in] $object Un object user ($this -> userObjectType) : l'utilisateur à ajouter + * + * @retval boolean true si l'utilisateur à été ajouté, False sinon + **/ + function addOneMember($object) { + return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Supprime un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à supprimer + * + * @retval boolean true si l'utilisateur à été supprimé, False sinon + **/ + function deleteOneMember($object) { + return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Renome un utilisateur du groupe + * + * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à renomer + * @param[in] $oldDn string L'ancien DN de l'utilisateur + * + * @retval boolean True en cas de succès, False sinon + */ + function renameOneMember($object,$oldDn) { + return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue); + } + + /** + * Met à jour les groupes d'un utilisateur + * + * @param[in] $object Mixed Un object (type : $this -> userObjectType) : l'utilisateur + * @param[in] $listDns Array(string) Un tableau des DNs des groupes de l'utilisateur + * + * @retval boolean true si tout c'est bien passé, False sinon + **/ + function updateUserGroups($object,$listDns) { + return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation'); + } + + /** + * Test si l'utilisateur peut d'editer la relation avec ce groupe + * + * @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon + **/ + function canEditGroupRelation($dn=NULL) { + if (!$dn) { + $dn=$this -> dn; + } + return LSsession :: canEdit($this -> type_name,$this -> dn,$this -> memberAttr); + } +} + +?> diff --git a/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtUtilisateur.php b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtUtilisateur.php new file mode 100644 index 0000000..e0539fd --- /dev/null +++ b/poc-2/ldapsaisie-conf/includes/class/class.LSobjects.cfdtUtilisateur.php @@ -0,0 +1,6 @@ +