mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 09:21:02 +00:00
[Feature] 添加同步 LDAP/AD 用户的定时任务2(添加同步参数配置项)
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user