# HG changeset patch # User Thierry Florac # Date 1541432049 -3600 # Node ID 0cde6357775dcc1adfa1dbfdcd03add23d52f9bf # Parent bf589bc395924d847bf32a63914f10444ca698c9 Updated LDAP connection mode and removed pool support diff -r bf589bc39592 -r 0cde6357775d src/pyams_ldap/interfaces/__init__.py --- a/src/pyams_ldap/interfaces/__init__.py Fri Apr 27 10:36:33 2018 +0200 +++ b/src/pyams_ldap/interfaces/__init__.py Mon Nov 05 16:34:09 2018 +0100 @@ -89,6 +89,10 @@ default="ldap://localhost:389", required=True) + use_tls = Bool(title=_("Use TLS?"), + required=True, + default=False) + bind_dn = TextLine(title=_("Bind DN"), description=_("DN used for LDAP bind; keep empty for anonymous"), required=False) @@ -97,22 +101,6 @@ description=_("Password used for LDAP bind"), required=False) - use_tls = Bool(title=_("Use TLS?"), - required=True, - default=False) - - use_pool = Bool(title=_("Use connections pool?"), - required=True, - default=True) - - pool_size = Int(title=_("Pool size"), - required=False, - default=10) - - pool_lifetime = Int(title=_("Pool lifetime"), - description=_("Duration, in seconds, of pool lifetime"), - required=False) - base_dn = TextLine(title=_("Base DN"), description=_("LDAP base DN"), required=True) diff -r bf589bc39592 -r 0cde6357775d src/pyams_ldap/locales/fr/LC_MESSAGES/pyams_ldap.mo Binary file src/pyams_ldap/locales/fr/LC_MESSAGES/pyams_ldap.mo has changed diff -r bf589bc39592 -r 0cde6357775d src/pyams_ldap/locales/fr/LC_MESSAGES/pyams_ldap.po --- a/src/pyams_ldap/locales/fr/LC_MESSAGES/pyams_ldap.po Fri Apr 27 10:36:33 2018 +0200 +++ b/src/pyams_ldap/locales/fr/LC_MESSAGES/pyams_ldap.po Mon Nov 05 16:34:09 2018 +0100 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE 1.0\n" -"POT-Creation-Date: 2016-10-13 10:59+0200\n" +"POT-Creation-Date: 2018-11-05 16:30+0100\n" "PO-Revision-Date: 2015-02-28 09:17+0100\n" "Last-Translator: Thierry Florac \n" "Language-Team: French\n" @@ -16,55 +16,55 @@ "Generated-By: Lingua 3.10.dev0\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: src/pyams_ldap/zmi/plugin.py:71 +#: src/pyams_ldap/zmi/plugin.py:67 msgid "Add LDAP users folder..." msgstr "Ajouter un annuaire LDAP" -#: src/pyams_ldap/zmi/plugin.py:91 +#: src/pyams_ldap/zmi/plugin.py:87 msgid "System security manager" msgstr "Gestionnaire de sécurité" -#: src/pyams_ldap/zmi/plugin.py:92 +#: src/pyams_ldap/zmi/plugin.py:88 msgid "Add LDAP users folder plug-in" msgstr "Ajout d'un annuaire LDAP" -#: src/pyams_ldap/zmi/plugin.py:125 src/pyams_ldap/zmi/plugin.py:225 +#: src/pyams_ldap/zmi/plugin.py:122 src/pyams_ldap/zmi/plugin.py:233 msgid "Connection" msgstr "Connexion" -#: src/pyams_ldap/zmi/plugin.py:137 src/pyams_ldap/zmi/plugin.py:237 +#: src/pyams_ldap/zmi/plugin.py:134 src/pyams_ldap/zmi/plugin.py:247 msgid "Users schema" msgstr "Schéma des utilisateurs" -#: src/pyams_ldap/zmi/plugin.py:150 src/pyams_ldap/zmi/plugin.py:250 +#: src/pyams_ldap/zmi/plugin.py:151 src/pyams_ldap/zmi/plugin.py:265 msgid "Groups schema" msgstr "Schéma des groupes" -#: src/pyams_ldap/zmi/plugin.py:166 src/pyams_ldap/zmi/plugin.py:266 +#: src/pyams_ldap/zmi/plugin.py:171 src/pyams_ldap/zmi/plugin.py:286 msgid "Search settings" msgstr "Recherches" -#: src/pyams_ldap/zmi/plugin.py:190 +#: src/pyams_ldap/zmi/plugin.py:197 msgid "Edit LDAP users folder plug-in properties" msgstr "Modification des propriétés d'un dossier d'accès LDAP" -#: src/pyams_ldap/zmi/plugin.py:294 +#: src/pyams_ldap/zmi/plugin.py:316 msgid "Security manager" msgstr "Gestionnaire de sécurité" -#: src/pyams_ldap/zmi/plugin.py:307 +#: src/pyams_ldap/zmi/plugin.py:329 msgid "Search results" msgstr "Résultats de la recherche" -#: src/pyams_ldap/zmi/plugin.py:337 +#: src/pyams_ldap/zmi/plugin.py:362 msgid "Common name" msgstr "Nom courant" -#: src/pyams_ldap/zmi/plugin.py:347 +#: src/pyams_ldap/zmi/plugin.py:372 msgid "E-mail" msgstr "Adresse email" -#: src/pyams_ldap/zmi/plugin.py:366 +#: src/pyams_ldap/zmi/plugin.py:391 #, python-format msgid "Display LDAP entry: {dn}" msgstr "Entrée LDAP : {dn}" @@ -110,67 +110,51 @@ msgstr "URI complète (y compris le protocole) d'accès au serveur LDAP" #: src/pyams_ldap/interfaces/__init__.py:92 +msgid "Use TLS?" +msgstr "Utiliser TLS ?" + +#: src/pyams_ldap/interfaces/__init__.py:96 msgid "Bind DN" msgstr "DN de connexion" -#: src/pyams_ldap/interfaces/__init__.py:93 +#: src/pyams_ldap/interfaces/__init__.py:97 msgid "DN used for LDAP bind; keep empty for anonymous" msgstr "" "DN utilisé pour la connexion LDAP ; laissez vide pour une connexion anonyme" -#: src/pyams_ldap/interfaces/__init__.py:96 +#: src/pyams_ldap/interfaces/__init__.py:100 msgid "Bind password" msgstr "Mot de passe" -#: src/pyams_ldap/interfaces/__init__.py:97 +#: src/pyams_ldap/interfaces/__init__.py:101 msgid "Password used for LDAP bind" msgstr "Mot de passe utilisé pour la connexion LDAP" -#: src/pyams_ldap/interfaces/__init__.py:100 -msgid "Use TLS?" -msgstr "Utiliser TLS ?" - #: src/pyams_ldap/interfaces/__init__.py:104 -msgid "Use connections pool?" -msgstr "Pool de connexions ?" - -#: src/pyams_ldap/interfaces/__init__.py:108 -msgid "Pool size" -msgstr "Taille du pool" - -#: src/pyams_ldap/interfaces/__init__.py:112 -msgid "Pool lifetime" -msgstr "Durée de vie du pool" - -#: src/pyams_ldap/interfaces/__init__.py:113 -msgid "Duration, in seconds, of pool lifetime" -msgstr "En secondes" - -#: src/pyams_ldap/interfaces/__init__.py:116 msgid "Base DN" msgstr "DN de base" -#: src/pyams_ldap/interfaces/__init__.py:117 +#: src/pyams_ldap/interfaces/__init__.py:105 msgid "LDAP base DN" msgstr "DN de base pour la recherche des utilisateurs" -#: src/pyams_ldap/interfaces/__init__.py:120 +#: src/pyams_ldap/interfaces/__init__.py:108 msgid "Search scope" msgstr "Portée de la recherche" -#: src/pyams_ldap/interfaces/__init__.py:125 +#: src/pyams_ldap/interfaces/__init__.py:113 msgid "Login attribute" msgstr "Attribut de connexion" -#: src/pyams_ldap/interfaces/__init__.py:126 +#: src/pyams_ldap/interfaces/__init__.py:114 msgid "LDAP attribute used as user login" msgstr "Nom de l'attribut LDAP utilisé lors de la connexion" -#: src/pyams_ldap/interfaces/__init__.py:130 +#: src/pyams_ldap/interfaces/__init__.py:118 msgid "Login query" msgstr "Requête de connexion" -#: src/pyams_ldap/interfaces/__init__.py:131 +#: src/pyams_ldap/interfaces/__init__.py:119 msgid "" "Query template used to authenticate user (based on login attribute called " "'login')" @@ -178,19 +162,19 @@ "Modèle de la requête utilisée lors de la connexion d'un utilisateur ; la " "variable 'login' correspond à la saisie de l'utilisateur" -#: src/pyams_ldap/interfaces/__init__.py:136 +#: src/pyams_ldap/interfaces/__init__.py:124 msgid "UID attribute" msgstr "Attribut UID" -#: src/pyams_ldap/interfaces/__init__.py:137 +#: src/pyams_ldap/interfaces/__init__.py:125 msgid "LDAP attribute used as principal identifier" msgstr "Attribut LDAP unique utilisé pour l'identification d'un utilisateur" -#: src/pyams_ldap/interfaces/__init__.py:141 +#: src/pyams_ldap/interfaces/__init__.py:129 msgid "UID query" msgstr "Requête d'UID" -#: src/pyams_ldap/interfaces/__init__.py:142 +#: src/pyams_ldap/interfaces/__init__.py:130 msgid "" "Query template used to get principal information (based on UID attribute " "called 'login')" @@ -198,107 +182,107 @@ "Modèle de la requête utilisée pour rechercher les informations relatives à " "un utilisateur à partir de son UID (variable 'login')" -#: src/pyams_ldap/interfaces/__init__.py:147 +#: src/pyams_ldap/interfaces/__init__.py:135 msgid "Title format" msgstr "Format du nom" -#: src/pyams_ldap/interfaces/__init__.py:148 -#: src/pyams_ldap/interfaces/__init__.py:182 +#: src/pyams_ldap/interfaces/__init__.py:136 +#: src/pyams_ldap/interfaces/__init__.py:170 msgid "Principal's title format string" msgstr "Chaîne de formatage du nom" -#: src/pyams_ldap/interfaces/__init__.py:152 -#: src/pyams_ldap/interfaces/__init__.py:223 +#: src/pyams_ldap/interfaces/__init__.py:140 +#: src/pyams_ldap/interfaces/__init__.py:211 msgid "Mail attribute" msgstr "Attribut 'adresse'" -#: src/pyams_ldap/interfaces/__init__.py:153 +#: src/pyams_ldap/interfaces/__init__.py:141 msgid "LDAP attribute storing mail address" msgstr "Nom de l'attribut LDAP contenant l'adresse de messagerie" -#: src/pyams_ldap/interfaces/__init__.py:157 -#: src/pyams_ldap/interfaces/__init__.py:228 +#: src/pyams_ldap/interfaces/__init__.py:145 +#: src/pyams_ldap/interfaces/__init__.py:216 msgid "Extra attributes" msgstr "Autres attributs" -#: src/pyams_ldap/interfaces/__init__.py:158 -#: src/pyams_ldap/interfaces/__init__.py:229 +#: src/pyams_ldap/interfaces/__init__.py:146 +#: src/pyams_ldap/interfaces/__init__.py:217 msgid "Comma separated list of additional attributes" msgstr "Liste d'attributs supplémentaires à extraire, séparés par des virgules" -#: src/pyams_ldap/interfaces/__init__.py:161 +#: src/pyams_ldap/interfaces/__init__.py:149 msgid "Groups base DN" msgstr "DN de base" -#: src/pyams_ldap/interfaces/__init__.py:162 +#: src/pyams_ldap/interfaces/__init__.py:150 msgid "Base DN used to search LDAP groups; keep empty to disable groups usage" msgstr "" "DN de base pour la recherche des groupes ; laissez le vide pour ne pas " "activer la gestion des groupes" -#: src/pyams_ldap/interfaces/__init__.py:166 +#: src/pyams_ldap/interfaces/__init__.py:154 msgid "Groups search scope" msgstr "Portée de la recherche" -#: src/pyams_ldap/interfaces/__init__.py:171 +#: src/pyams_ldap/interfaces/__init__.py:159 msgid "Group prefix" msgstr "Préfixe des groupes" -#: src/pyams_ldap/interfaces/__init__.py:172 +#: src/pyams_ldap/interfaces/__init__.py:160 msgid "Prefix used to identify groups" msgstr "Préfixe utilisé pour identifier les groupes" -#: src/pyams_ldap/interfaces/__init__.py:176 +#: src/pyams_ldap/interfaces/__init__.py:164 msgid "Group UID attribute" msgstr "Attribut UID" -#: src/pyams_ldap/interfaces/__init__.py:177 +#: src/pyams_ldap/interfaces/__init__.py:165 msgid "LDAP attribute used as group identifier" msgstr "Attribut LDAP utilisé pour identifier les groupes" -#: src/pyams_ldap/interfaces/__init__.py:181 +#: src/pyams_ldap/interfaces/__init__.py:169 msgid "Group title format" msgstr "Format du nom" -#: src/pyams_ldap/interfaces/__init__.py:186 +#: src/pyams_ldap/interfaces/__init__.py:174 msgid "Members query mode" msgstr "Recherche des membres" -#: src/pyams_ldap/interfaces/__init__.py:187 +#: src/pyams_ldap/interfaces/__init__.py:175 msgid "Define how groups members are defined" msgstr "Indique la façon dont les membres d'un groupe sont définis" -#: src/pyams_ldap/interfaces/__init__.py:191 +#: src/pyams_ldap/interfaces/__init__.py:179 msgid "Groups query" msgstr "Recherche des groupes" -#: src/pyams_ldap/interfaces/__init__.py:192 +#: src/pyams_ldap/interfaces/__init__.py:180 msgid "" "When members are store inside a group attribute, this query template is used " "to get principal groups (based on DN and UID attributes called 'dn' and " "'login')" msgstr "" -"Lorsque les membres d'un groupe sont définis via un attribut du groupe, ce modèle de " -"requête est utilisé pour extraire la liste des groupes d'un " +"Lorsque les membres d'un groupe sont définis via un attribut du groupe, ce " +"modèle de requête est utilisé pour extraire la liste des groupes d'un " "utilisateur (à partir de ses attributes appelés 'dn' et 'uid')" -#: src/pyams_ldap/interfaces/__init__.py:199 +#: src/pyams_ldap/interfaces/__init__.py:187 msgid "Group members attribute" msgstr "Membres d'un groupe" -#: src/pyams_ldap/interfaces/__init__.py:200 +#: src/pyams_ldap/interfaces/__init__.py:188 msgid "" "When groups members are stored inside a group attribute, this is the " "attribute name" msgstr "" -"Lorsque les membres d'un groupe sont définis via un attribut du groupe, ceci est le " -"nom de l'attribut concerné" +"Lorsque les membres d'un groupe sont définis via un attribut du groupe, ceci " +"est le nom de l'attribut concerné" -#: src/pyams_ldap/interfaces/__init__.py:205 +#: src/pyams_ldap/interfaces/__init__.py:193 msgid "User groups attribute" msgstr "Groupes d'un membre" -#: src/pyams_ldap/interfaces/__init__.py:206 +#: src/pyams_ldap/interfaces/__init__.py:194 msgid "" "When user groups are stored inside a user attribute, this is the attribute " "name" @@ -306,63 +290,77 @@ "Lorsque les groupes d'un utilisateur sont définis par un attribut de " "l'utilisateur, ceci est le nom de l'attribut concerné" -#: src/pyams_ldap/interfaces/__init__.py:211 +#: src/pyams_ldap/interfaces/__init__.py:199 msgid "Group mail mode" msgstr "Messagerie de groupe" -#: src/pyams_ldap/interfaces/__init__.py:212 +#: src/pyams_ldap/interfaces/__init__.py:200 msgid "Define how an email can be sent to group members" -msgstr "Déterminer la façon dont un message peut être envoyé à tous les membres d'un groupe" +msgstr "" +"Déterminer la façon dont un message peut être envoyé à tous les membres d'un " +"groupe" -#: src/pyams_ldap/interfaces/__init__.py:217 +#: src/pyams_ldap/interfaces/__init__.py:205 msgid "DN replace expression" msgstr "Remplacement du DN" -#: src/pyams_ldap/interfaces/__init__.py:218 +#: src/pyams_ldap/interfaces/__init__.py:206 msgid "" "In 'redirect' mail mode, specify source and target DN parts, separated by a " "pipe" msgstr "" -"En mode 'redirection', indique les éléments du DN à remplacer, " -"sous la forme 'DN source|DN destination'" +"En mode 'redirection', indique les éléments du DN à remplacer, sous la forme " +"'DN source|DN destination'" -#: src/pyams_ldap/interfaces/__init__.py:224 +#: src/pyams_ldap/interfaces/__init__.py:212 msgid "In 'internal' mail mode, specify name of group mail attribute" msgstr "" "En mode 'direct', indique le nom de l'attribut contenant l'adresse de " "messagerie du groupe" -#: src/pyams_ldap/interfaces/__init__.py:232 +#: src/pyams_ldap/interfaces/__init__.py:220 msgid "Users select query" msgstr "Sélection des utilisateurs" -#: src/pyams_ldap/interfaces/__init__.py:233 +#: src/pyams_ldap/interfaces/__init__.py:221 msgid "Query template used to select users" msgstr "Modèle de la requête utilisée pour la sélection des utilisateurs" -#: src/pyams_ldap/interfaces/__init__.py:237 +#: src/pyams_ldap/interfaces/__init__.py:225 msgid "Users search query" msgstr "Recherche des utilisateurs" -#: src/pyams_ldap/interfaces/__init__.py:238 +#: src/pyams_ldap/interfaces/__init__.py:226 msgid "Query template used to search users" msgstr "Modèle de la requête utilisée pour la recherche des utilisateurs" -#: src/pyams_ldap/interfaces/__init__.py:242 +#: src/pyams_ldap/interfaces/__init__.py:230 msgid "Groups select query" msgstr "Sélection des groupes" -#: src/pyams_ldap/interfaces/__init__.py:243 +#: src/pyams_ldap/interfaces/__init__.py:231 msgid "Query template used to select groups" msgstr "Modèle de la requête utilisée pour la sélection des groupes" -#: src/pyams_ldap/interfaces/__init__.py:247 +#: src/pyams_ldap/interfaces/__init__.py:235 msgid "Groups search query" msgstr "Recherche des groupes" -#: src/pyams_ldap/interfaces/__init__.py:248 +#: src/pyams_ldap/interfaces/__init__.py:236 msgid "Query template used to search groups" msgstr "Modèle de la requête utilisée pour la recherche des groupes" +#~ msgid "Use connections pool?" +#~ msgstr "Pool de connexions ?" + +#~ msgid "Pool size" +#~ msgstr "Taille du pool" + +#~ msgid "Pool lifetime" +#~ msgstr "Durée de vie du pool" + +#~ msgid "Duration, in seconds, of pool lifetime" +#~ msgstr "En secondes" + #~ msgid "Search users and groups" #~ msgstr "Utilisateurs et groupes" diff -r bf589bc39592 -r 0cde6357775d src/pyams_ldap/locales/pyams_ldap.pot --- a/src/pyams_ldap/locales/pyams_ldap.pot Fri Apr 27 10:36:33 2018 +0200 +++ b/src/pyams_ldap/locales/pyams_ldap.pot Mon Nov 05 16:34:09 2018 +0100 @@ -1,12 +1,12 @@ -# +# # SOME DESCRIPTIVE TITLE # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , 2016. +# FIRST AUTHOR , 2018. #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE 1.0\n" -"POT-Creation-Date: 2016-10-13 10:59+0200\n" +"POT-Creation-Date: 2018-11-05 16:30+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" @@ -16,55 +16,55 @@ "Content-Transfer-Encoding: 8bit\n" "Generated-By: Lingua 3.10.dev0\n" -#: ./src/pyams_ldap/zmi/plugin.py:71 +#: ./src/pyams_ldap/zmi/plugin.py:67 msgid "Add LDAP users folder..." msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:91 +#: ./src/pyams_ldap/zmi/plugin.py:87 msgid "System security manager" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:92 +#: ./src/pyams_ldap/zmi/plugin.py:88 msgid "Add LDAP users folder plug-in" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:125 ./src/pyams_ldap/zmi/plugin.py:225 +#: ./src/pyams_ldap/zmi/plugin.py:122 ./src/pyams_ldap/zmi/plugin.py:233 msgid "Connection" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:137 ./src/pyams_ldap/zmi/plugin.py:237 +#: ./src/pyams_ldap/zmi/plugin.py:134 ./src/pyams_ldap/zmi/plugin.py:247 msgid "Users schema" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:150 ./src/pyams_ldap/zmi/plugin.py:250 +#: ./src/pyams_ldap/zmi/plugin.py:151 ./src/pyams_ldap/zmi/plugin.py:265 msgid "Groups schema" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:166 ./src/pyams_ldap/zmi/plugin.py:266 +#: ./src/pyams_ldap/zmi/plugin.py:171 ./src/pyams_ldap/zmi/plugin.py:286 msgid "Search settings" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:190 +#: ./src/pyams_ldap/zmi/plugin.py:197 msgid "Edit LDAP users folder plug-in properties" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:294 +#: ./src/pyams_ldap/zmi/plugin.py:316 msgid "Security manager" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:307 +#: ./src/pyams_ldap/zmi/plugin.py:329 msgid "Search results" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:337 +#: ./src/pyams_ldap/zmi/plugin.py:362 msgid "Common name" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:347 +#: ./src/pyams_ldap/zmi/plugin.py:372 msgid "E-mail" msgstr "" -#: ./src/pyams_ldap/zmi/plugin.py:366 +#: ./src/pyams_ldap/zmi/plugin.py:391 #, python-format msgid "Display LDAP entry: {dn}" msgstr "" @@ -110,238 +110,222 @@ msgstr "" #: ./src/pyams_ldap/interfaces/__init__.py:92 +msgid "Use TLS?" +msgstr "" + +#: ./src/pyams_ldap/interfaces/__init__.py:96 msgid "Bind DN" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:93 +#: ./src/pyams_ldap/interfaces/__init__.py:97 msgid "DN used for LDAP bind; keep empty for anonymous" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:96 +#: ./src/pyams_ldap/interfaces/__init__.py:100 msgid "Bind password" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:97 +#: ./src/pyams_ldap/interfaces/__init__.py:101 msgid "Password used for LDAP bind" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:100 -msgid "Use TLS?" +#: ./src/pyams_ldap/interfaces/__init__.py:104 +msgid "Base DN" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:104 -msgid "Use connections pool?" +#: ./src/pyams_ldap/interfaces/__init__.py:105 +msgid "LDAP base DN" msgstr "" #: ./src/pyams_ldap/interfaces/__init__.py:108 -msgid "Pool size" -msgstr "" - -#: ./src/pyams_ldap/interfaces/__init__.py:112 -msgid "Pool lifetime" +msgid "Search scope" msgstr "" #: ./src/pyams_ldap/interfaces/__init__.py:113 -msgid "Duration, in seconds, of pool lifetime" -msgstr "" - -#: ./src/pyams_ldap/interfaces/__init__.py:116 -msgid "Base DN" -msgstr "" - -#: ./src/pyams_ldap/interfaces/__init__.py:117 -msgid "LDAP base DN" -msgstr "" - -#: ./src/pyams_ldap/interfaces/__init__.py:120 -msgid "Search scope" -msgstr "" - -#: ./src/pyams_ldap/interfaces/__init__.py:125 msgid "Login attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:126 +#: ./src/pyams_ldap/interfaces/__init__.py:114 msgid "LDAP attribute used as user login" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:130 +#: ./src/pyams_ldap/interfaces/__init__.py:118 msgid "Login query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:131 +#: ./src/pyams_ldap/interfaces/__init__.py:119 msgid "" "Query template used to authenticate user (based on login attribute called " "'login')" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:136 +#: ./src/pyams_ldap/interfaces/__init__.py:124 msgid "UID attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:137 +#: ./src/pyams_ldap/interfaces/__init__.py:125 msgid "LDAP attribute used as principal identifier" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:141 +#: ./src/pyams_ldap/interfaces/__init__.py:129 msgid "UID query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:142 +#: ./src/pyams_ldap/interfaces/__init__.py:130 msgid "" "Query template used to get principal information (based on UID attribute " "called 'login')" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:147 +#: ./src/pyams_ldap/interfaces/__init__.py:135 msgid "Title format" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:148 -#: ./src/pyams_ldap/interfaces/__init__.py:182 +#: ./src/pyams_ldap/interfaces/__init__.py:136 +#: ./src/pyams_ldap/interfaces/__init__.py:170 msgid "Principal's title format string" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:152 -#: ./src/pyams_ldap/interfaces/__init__.py:223 +#: ./src/pyams_ldap/interfaces/__init__.py:140 +#: ./src/pyams_ldap/interfaces/__init__.py:211 msgid "Mail attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:153 +#: ./src/pyams_ldap/interfaces/__init__.py:141 msgid "LDAP attribute storing mail address" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:157 -#: ./src/pyams_ldap/interfaces/__init__.py:228 +#: ./src/pyams_ldap/interfaces/__init__.py:145 +#: ./src/pyams_ldap/interfaces/__init__.py:216 msgid "Extra attributes" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:158 -#: ./src/pyams_ldap/interfaces/__init__.py:229 +#: ./src/pyams_ldap/interfaces/__init__.py:146 +#: ./src/pyams_ldap/interfaces/__init__.py:217 msgid "Comma separated list of additional attributes" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:161 +#: ./src/pyams_ldap/interfaces/__init__.py:149 msgid "Groups base DN" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:162 +#: ./src/pyams_ldap/interfaces/__init__.py:150 msgid "Base DN used to search LDAP groups; keep empty to disable groups usage" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:166 +#: ./src/pyams_ldap/interfaces/__init__.py:154 msgid "Groups search scope" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:171 +#: ./src/pyams_ldap/interfaces/__init__.py:159 msgid "Group prefix" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:172 +#: ./src/pyams_ldap/interfaces/__init__.py:160 msgid "Prefix used to identify groups" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:176 +#: ./src/pyams_ldap/interfaces/__init__.py:164 msgid "Group UID attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:177 +#: ./src/pyams_ldap/interfaces/__init__.py:165 msgid "LDAP attribute used as group identifier" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:181 +#: ./src/pyams_ldap/interfaces/__init__.py:169 msgid "Group title format" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:186 +#: ./src/pyams_ldap/interfaces/__init__.py:174 msgid "Members query mode" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:187 +#: ./src/pyams_ldap/interfaces/__init__.py:175 msgid "Define how groups members are defined" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:191 +#: ./src/pyams_ldap/interfaces/__init__.py:179 msgid "Groups query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:192 +#: ./src/pyams_ldap/interfaces/__init__.py:180 msgid "" "When members are store inside a group attribute, this query template is used " "to get principal groups (based on DN and UID attributes called 'dn' and " "'login')" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:199 +#: ./src/pyams_ldap/interfaces/__init__.py:187 msgid "Group members attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:200 +#: ./src/pyams_ldap/interfaces/__init__.py:188 msgid "" "When groups members are stored inside a group attribute, this is the " "attribute name" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:205 +#: ./src/pyams_ldap/interfaces/__init__.py:193 msgid "User groups attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:206 +#: ./src/pyams_ldap/interfaces/__init__.py:194 msgid "" "When user groups are stored inside a user attribute, this is the attribute " "name" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:211 +#: ./src/pyams_ldap/interfaces/__init__.py:199 msgid "Group mail mode" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:212 +#: ./src/pyams_ldap/interfaces/__init__.py:200 msgid "Define how an email can be sent to group members" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:217 +#: ./src/pyams_ldap/interfaces/__init__.py:205 msgid "DN replace expression" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:218 +#: ./src/pyams_ldap/interfaces/__init__.py:206 msgid "" "In 'redirect' mail mode, specify source and target DN parts, separated by a " "pipe" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:224 +#: ./src/pyams_ldap/interfaces/__init__.py:212 msgid "In 'internal' mail mode, specify name of group mail attribute" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:232 +#: ./src/pyams_ldap/interfaces/__init__.py:220 msgid "Users select query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:233 +#: ./src/pyams_ldap/interfaces/__init__.py:221 msgid "Query template used to select users" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:237 +#: ./src/pyams_ldap/interfaces/__init__.py:225 msgid "Users search query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:238 +#: ./src/pyams_ldap/interfaces/__init__.py:226 msgid "Query template used to search users" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:242 +#: ./src/pyams_ldap/interfaces/__init__.py:230 msgid "Groups select query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:243 +#: ./src/pyams_ldap/interfaces/__init__.py:231 msgid "Query template used to select groups" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:247 +#: ./src/pyams_ldap/interfaces/__init__.py:235 msgid "Groups search query" msgstr "" -#: ./src/pyams_ldap/interfaces/__init__.py:248 +#: ./src/pyams_ldap/interfaces/__init__.py:236 msgid "Query template used to search groups" msgstr "" diff -r bf589bc39592 -r 0cde6357775d src/pyams_ldap/plugin.py --- a/src/pyams_ldap/plugin.py Fri Apr 27 10:36:33 2018 +0200 +++ b/src/pyams_ldap/plugin.py Mon Nov 05 16:34:09 2018 +0100 @@ -12,20 +12,16 @@ __docformat__ = 'restructuredtext' - -# import standard library -import ldap3 import logging logger = logging.getLogger('PyAMS (ldap)') +import ldap3 import re -# import interfaces from pyams_ldap.interfaces import ILDAPPlugin, ILDAPUserInfo, ILDAPGroupInfo from pyams_mail.interfaces import IPrincipalMailInfo from zope.intid.interfaces import IIntIds -# import packages from beaker.cache import cache_region from persistent import Persistent from pyams_ldap.query import LDAPQuery @@ -39,7 +35,6 @@ managers = {} - FORMAT_ATTRIBUTES = re.compile("\{(\w+)\[?\d*\]?\}") @@ -53,31 +48,24 @@ tls=plugin.use_tls) self.bind_dn = plugin.bind_dn self.password = plugin.bind_password - if plugin.use_pool: - self.strategy = ldap3.REUSABLE - self.pool_name = 'pyams_ldap:{prefix}'.format(prefix=plugin.prefix) - self.pool_size = plugin.pool_size - self.pool_lifetime = plugin.pool_lifetime - else: - self.strategy = ldap3.ASYNC - self.pool_name = None - self.pool_size = None - self.pool_lifetime = None - def get_connection(self, user=None, password=None): + def get_connection(self, user=None, password=None, read_only=True): if user: conn = ldap3.Connection(self.server, user=user, password=password, - client_strategy=ldap3.SYNC, - auto_bind=True, lazy=False, read_only=True) + client_strategy=ldap3.ASYNC, + auto_bind=ldap3.AUTO_BIND_DEFAULT, + lazy=True, + read_only=read_only) else: conn = ldap3.Connection(self.server, user=self.bind_dn, password=self.password, - client_strategy=self.strategy, - pool_name=self.pool_name, - pool_size=self.pool_size, - pool_lifetime=self.pool_lifetime, - auto_bind=True, lazy=False, read_only=True) + client_strategy=ldap3.REUSABLE, + auto_bind=ldap3.AUTO_BIND_DEFAULT if self.bind_dn else ldap3.AUTO_BIND_NONE, + lazy=True, + read_only=read_only) + if conn.auto_bind == ldap3.AUTO_BIND_NONE: + conn.open(read_server_info=False) return conn @@ -178,12 +166,10 @@ _use_ssl = False _server_uri = FieldProperty(ILDAPPlugin['server_uri']) + use_tls = FieldProperty(ILDAPPlugin['use_tls']) bind_dn = FieldProperty(ILDAPPlugin['bind_dn']) bind_password = FieldProperty(ILDAPPlugin['bind_password']) - use_tls = FieldProperty(ILDAPPlugin['use_tls']) - use_pool = FieldProperty(ILDAPPlugin['use_pool']) - pool_size = FieldProperty(ILDAPPlugin['pool_size']) - pool_lifetime = FieldProperty(ILDAPPlugin['pool_lifetime']) + base_dn = FieldProperty(ILDAPPlugin['base_dn']) search_scope = FieldProperty(ILDAPPlugin['search_scope']) diff -r bf589bc39592 -r 0cde6357775d src/pyams_ldap/zmi/plugin.py --- a/src/pyams_ldap/zmi/plugin.py Fri Apr 27 10:36:33 2018 +0200 +++ b/src/pyams_ldap/zmi/plugin.py Mon Nov 05 16:34:09 2018 +0100 @@ -12,48 +12,44 @@ __docformat__ = 'restructuredtext' - -# import standard library import base64 -import ldap3 -# import interfaces +import ldap3 +from pyramid.view import view_config +from z3c.form import field +from z3c.form.interfaces import DISPLAY_MODE +from z3c.table.column import GetAttrColumn +from z3c.table.interfaces import IColumn +from zope.component.interfaces import ISite +from zope.interface import Interface, implementer + +from pyams_form.form import AJAXAddForm, AJAXEditForm from pyams_form.interfaces.form import IInnerTabForm, IWidgetsSuffixViewletsManager +from pyams_form.search import SearchResultsView, SearchView from pyams_ldap.interfaces import ILDAPPlugin -from pyams_security.interfaces import ISecurityManager, IPlugin +from pyams_ldap.plugin import LDAPPlugin +from pyams_ldap.query import LDAPQuery +from pyams_pagelet.pagelet import pagelet_config +from pyams_security.interfaces import IPlugin, ISecurityManager +from pyams_security.zmi.utility import SecurityManagerPluginsTable from pyams_skin.interfaces import IPageHeader from pyams_skin.interfaces.viewlet import IToolbarAddingMenu from pyams_skin.layer import IPyAMSLayer -from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SECURITY_PERMISSION -from pyams_zmi.interfaces import IAdminView -from pyams_zmi.layer import IAdminLayer -from z3c.form.interfaces import DISPLAY_MODE -from z3c.table.interfaces import IColumn -from zope.component.interfaces import ISite - -# import packages -from pyams_form.form import AJAXAddForm, AJAXEditForm -from pyams_form.search import SearchView, SearchResultsView -from pyams_ldap.plugin import LDAPPlugin -from pyams_ldap.query import LDAPQuery -from pyams_pagelet.pagelet import pagelet_config -from pyams_security.zmi.utility import SecurityManagerPluginsTable from pyams_skin.page import DefaultPageHeaderAdapter from pyams_skin.skin import apply_skin from pyams_skin.table import I18nColumn from pyams_skin.viewlet.toolbar import ToolbarMenuItem from pyams_template.template import template_config from pyams_utils.adapter import adapter_config +from pyams_utils.interfaces import MANAGE_SECURITY_PERMISSION, VIEW_SYSTEM_PERMISSION from pyams_utils.registry import query_utility from pyams_utils.url import absolute_url -from pyams_viewlet.viewlet import viewlet_config, Viewlet -from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm, AdminDialogDisplayForm, InnerAdminAddForm, \ +from pyams_viewlet.viewlet import Viewlet, viewlet_config +from pyams_zmi.form import AdminDialogAddForm, AdminDialogDisplayForm, AdminDialogEditForm, InnerAdminAddForm, \ InnerAdminEditForm +from pyams_zmi.interfaces import IAdminView +from pyams_zmi.layer import IAdminLayer from pyams_zmi.view import AdminView -from pyramid.view import view_config -from z3c.form import field -from z3c.table.column import GetAttrColumn -from zope.interface import implementer, Interface from pyams_ldap import _ @@ -125,8 +121,7 @@ tab_label = _("Connection") legend = None - fields = field.Fields(ILDAPPlugin).select('server_uri', 'bind_dn', 'bind_password', 'use_tls', - 'use_pool', 'pool_size', 'pool_lifetime') + fields = field.Fields(ILDAPPlugin).select('server_uri', 'use_tls', 'bind_dn', 'bind_password') weight = 1 @@ -237,8 +232,7 @@ tab_label = _("Connection") legend = None - fields = field.Fields(ILDAPPlugin).select('server_uri', 'bind_dn', 'bind_password', 'use_tls', - 'use_pool', 'pool_size', 'pool_lifetime') + fields = field.Fields(ILDAPPlugin).select('server_uri', 'use_tls', 'bind_dn', 'bind_password') edit_permission = MANAGE_SECURITY_PERMISSION weight = 1 @@ -422,6 +416,6 @@ dn, attributes = result[0] if 'jpegPhoto' in attributes: attributes['jpegPhoto'] = [''. - format(base64.encodebytes(attributes['jpegPhoto'][0]).decode()), ] + format(base64.encodebytes(attributes['jpegPhoto'][0]).decode()), ] result = sorted(attributes.items(), key=lambda x: x[0]) return result