Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
78a7bfbd
Commit
78a7bfbd
authored
Nov 11, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修复取消 LDAP 同步用户任务失败的问题
parent
fc58906b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
ldap.py
apps/settings/utils/ldap.py
+1
-2
tasks.py
apps/users/tasks.py
+6
-1
No files found.
apps/settings/utils/ldap.py
View file @
78a7bfbd
...
...
@@ -117,8 +117,6 @@ class LDAPServerUtil(object):
return
search_filter
def
search_user_entries_ou
(
self
,
search_ou
,
paged_cookie
=
None
):
logger
.
info
(
"Search user entries ou: {}, paged_cookie: {}"
.
format
(
search_ou
,
paged_cookie
))
search_filter
=
self
.
get_search_filter
()
attributes
=
list
(
self
.
config
.
attr_map
.
values
())
ok
=
self
.
connection
.
search
(
...
...
@@ -136,6 +134,7 @@ class LDAPServerUtil(object):
user_entries
=
list
()
search_ous
=
str
(
self
.
config
.
search_ougroup
)
.
split
(
'|'
)
for
search_ou
in
search_ous
:
logger
.
info
(
"Search user entries ou: {}"
.
format
(
search_ou
))
self
.
search_user_entries_ou
(
search_ou
)
user_entries
.
extend
(
self
.
connection
.
entries
)
while
self
.
paged_cookie
():
...
...
apps/users/tasks.py
View file @
78a7bfbd
# -*- coding: utf-8 -*-
#
import
sys
from
celery
import
shared_task
from
django.conf
import
settings
from
ops.celery.utils
import
create_or_update_celery_periodic_tasks
from
ops.celery.utils
import
(
create_or_update_celery_periodic_tasks
,
disable_celery_periodic_task
)
from
ops.celery.decorator
import
after_app_ready_start
from
common.utils
import
get_logger
from
.models
import
User
...
...
@@ -88,6 +91,8 @@ def import_ldap_user_periodic():
if
not
settings
.
AUTH_LDAP
:
return
if
not
settings
.
AUTH_LDAP_SYNC_IS_PERIODIC
:
task_name
=
sys
.
_getframe
()
.
f_code
.
co_name
disable_celery_periodic_task
(
task_name
)
return
interval
=
settings
.
AUTH_LDAP_SYNC_INTERVAL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment