Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Populate User From Ldap Without Login in Django

I'm using django-auth-ldap for auth backend in a Django project. But I have a problem, I can't give any permissions to a user before user once logged in. Because the user object created when user tring login to system.

I want to write a task to populate user from ldap periodically, how I can do that. I can't just login for each unpopulated user since I don't know their passwords.

like image 252
yozel Avatar asked Nov 23 '25 00:11

yozel


1 Answers

I found out I just can populate user like this:

    from django_auth_ldap.backend import LDAPBackend
    ldap_backend = LDAPBackend()
    ldap_backend.populate_user('username')
like image 157
yozel Avatar answered Nov 24 '25 15:11

yozel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!