[Feature] 添加同步 LDAP/AD 用户的定时任务2(添加同步参数配置项)

This commit is contained in:
BaiJiangJie
2019-09-27 18:19:19 +08:00
parent 8081a864da
commit 8b7c5b1545
4 changed files with 22 additions and 4 deletions

View File

@@ -82,11 +82,21 @@ def sync_ldap_user():
def sync_ldap_user_periodic():
if not settings.AUTH_LDAP:
return
if not settings.AUTH_LDAP_SYNC_IS_PERIODIC:
return
interval = settings.AUTH_LDAP_SYNC_INTERVAL
if isinstance(interval, int):
interval = interval * 3600
else:
interval = None
crontab = settings.AUTH_LDAP_SYNC_CRONTAB
tasks = {
'sync_ldap_user_periodic': {
'task': sync_ldap_user.name,
'interval': None,
'crontab': '* * * * *',
'interval': interval,
'crontab': crontab,
'enabled': True,
}
}