Skip to content

Commit 2298bfb

Browse files
committed
refac: conditional import of ldap3
1 parent b52a7e3 commit 2298bfb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backend/open_webui/routers/auths.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from open_webui.config import (
3535
OPENID_PROVIDER_URL,
3636
ENABLE_OAUTH_SIGNUP,
37+
ENABLE_LDAP
3738
)
3839
from pydantic import BaseModel
3940
from open_webui.utils.misc import parse_duration, validate_email_format
@@ -51,8 +52,10 @@
5152
from typing import Optional, List
5253

5354
from ssl import CERT_REQUIRED, PROTOCOL_TLS
54-
from ldap3 import Server, Connection, NONE, Tls
55-
from ldap3.utils.conv import escape_filter_chars
55+
56+
if ENABLE_LDAP.value:
57+
from ldap3 import Server, Connection, NONE, Tls
58+
from ldap3.utils.conv import escape_filter_chars
5659

5760
router = APIRouter()
5861

0 commit comments

Comments
 (0)