From ae73721e8fbfa8c368eb1fc61f9775edffbf5fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 30 Dec 2018 21:51:39 +0100 Subject: [PATCH] Add info about validate uniqueness --- doc/ldap.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/ldap.rst b/doc/ldap.rst index ea459732..41741d94 100644 --- a/doc/ldap.rst +++ b/doc/ldap.rst @@ -333,7 +333,7 @@ Validate uniqueness =================== There is a method to validate the uniquess of some entry that is used during -user creation. I haven't used it and I'm not sure on how it work. +user creation. It's usefull by example to be sure that we have no conflict about email between each user. Here is how it's used (I don't understand why a path is not provided): @@ -349,6 +349,19 @@ And here is its docstring: .. automethod:: moulinette.authenticators.ldap.Authenticator.update +Get conflict +============ + +Like the last function `validate_uniqueness` but give instead of rising an error this function return which attribute with witch value generate a conflict. + +:: + # Validate uniqueness of groupname in LDAP + conflict = auth.get_conflict({ + 'cn': groupname + }, base_dn='ou=groups,dc=yunohost,dc=org') + if conflict: + raise YunohostError('group_name_already_exist', name=groupname) + Remove entries from LDAP ========================