Created
May 3, 2017 13:31
-
-
Save etianen/1d5d98e2441c26d11e7bdba3e9a3a17c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# your_project/your_app/ldap.py | |
import django_python3_ldap.utils.clean_user_data | |
def clean_user_data(model_fields): | |
""" | |
Transforms the user data loaded from | |
LDAP into a form suitable for creating a user. | |
""" | |
# Call the default handler. | |
model_fields = django_python3_ldap.utils.clean_user_data(model_fields) | |
# Add our own data in. | |
model_fields["is_staff"] = True | |
model_fields["is_superuser"] = True | |
return model_fields | |
# settings.py | |
AUTH_CLEAN_USER_DATA = "your_project.your_app.clean_user_data" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks :)
Is it not LDAP_AUTH_CLEAN_USER_DATA instead of AUTH_CLEAN_USER_DATA in settings.py ?
Do you know if my ldap.py is in the right directory ?
I have this tree :
And is enough to put ldap.py file in the directory c2i to be taken into account ?
Last question, regarding my tree, is this var OK ?
LDAP_AUTH_CLEAN_USER_DATA = "c2i.clean_user_data"
With all of this, when I try to login, I have this error :
Regards.