2019-10-11 12:43:35 +01:00
|
|
|
"""LDAP Sync tasks"""
|
2019-10-11 11:53:48 +01:00
|
|
|
from passbook.root.celery import CELERY_APP
|
|
|
|
from passbook.sources.ldap.connector import Connector
|
|
|
|
from passbook.sources.ldap.models import LDAPSource
|
|
|
|
|
|
|
|
|
|
|
|
@CELERY_APP.task()
|
|
|
|
def sync():
|
|
|
|
"""Sync all sources"""
|
|
|
|
for source in LDAPSource.objects.filter(enabled=True):
|
|
|
|
connector = Connector(source)
|
|
|
|
connector.sync_users()
|
|
|
|
connector.sync_groups()
|
|
|
|
connector.sync_membership()
|