Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kontr 2.0
Portal API Backend
Commits
14be560b
Unverified
Commit
14be560b
authored
Sep 18, 2018
by
Peter Stanko
Browse files
LDAP connection should be single instance
parent
254078f4
Pipeline
#13214
passed with stage
in 36 minutes and 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
portal/tools/ldap_client.py
View file @
14be560b
...
...
@@ -57,7 +57,6 @@ class LDAPWrapper(object):
log
.
info
(
f
"[LDAP] Creating LDAP server instance
{
self
.
ldap_url
}
:
{
self
.
_ldap_server
}
"
)
return
self
.
_ldap_server
@
property
def
ldap_connection
(
self
):
connection
=
None
if
self
.
ldap
is
not
None
:
...
...
@@ -68,8 +67,9 @@ class LDAPWrapper(object):
def
search
(
self
,
selector
:
str
):
selector
=
selector
+
self
.
selector_base
log
.
debug
(
f
"[LDAP] Search
{
self
.
ldap_url
}
: (
{
selector
}
)"
)
self
.
ldap_connection
.
search
(
selector
,
'(objectclass=*)'
,
attributes
=
ldap3
.
ALL_ATTRIBUTES
)
entries
=
self
.
ldap_connection
.
entries
conn
=
self
.
ldap_connection
()
conn
.
search
(
selector
,
'(objectclass=*)'
,
attributes
=
ldap3
.
ALL_ATTRIBUTES
)
entries
=
conn
.
entries
if
entries
:
result
=
entries
[
0
]
log
.
debug
(
f
"[LDAP] Search (
{
selector
}
):
{
result
}
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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