ldap-ui 0.9.3__py3-none-any.whl → 0.9.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ldap_ui/__init__.py +1 -1
- ldap_ui/__main__.py +11 -3
- ldap_ui/app.py +11 -3
- {ldap_ui-0.9.3.dist-info → ldap_ui-0.9.5.dist-info}/METADATA +1 -1
- {ldap_ui-0.9.3.dist-info → ldap_ui-0.9.5.dist-info}/RECORD +9 -9
- {ldap_ui-0.9.3.dist-info → ldap_ui-0.9.5.dist-info}/LICENSE.txt +0 -0
- {ldap_ui-0.9.3.dist-info → ldap_ui-0.9.5.dist-info}/WHEEL +0 -0
- {ldap_ui-0.9.3.dist-info → ldap_ui-0.9.5.dist-info}/entry_points.txt +0 -0
- {ldap_ui-0.9.3.dist-info → ldap_ui-0.9.5.dist-info}/top_level.txt +0 -0
ldap_ui/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.9.
|
|
1
|
+
__version__ = "0.9.5"
|
ldap_ui/__main__.py
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
1
3
|
import click
|
|
2
4
|
import uvicorn
|
|
5
|
+
from uvicorn.config import LOG_LEVELS
|
|
6
|
+
from uvicorn.logging import ColourizedFormatter
|
|
3
7
|
from uvicorn.main import LEVEL_CHOICES
|
|
4
8
|
|
|
5
9
|
import ldap_ui
|
|
@@ -41,7 +45,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
|
41
45
|
"-l",
|
|
42
46
|
"--log-level",
|
|
43
47
|
type=LEVEL_CHOICES,
|
|
44
|
-
default=
|
|
48
|
+
default="info",
|
|
45
49
|
help="Log level. [default: info]",
|
|
46
50
|
show_default=True,
|
|
47
51
|
)
|
|
@@ -54,12 +58,16 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
|
54
58
|
help="Display the current version and exit.",
|
|
55
59
|
)
|
|
56
60
|
def main(base_dn, host, port, log_level):
|
|
57
|
-
|
|
61
|
+
logging.basicConfig(level=LOG_LEVELS[log_level])
|
|
62
|
+
rootHandler = logging.getLogger().handlers[0]
|
|
63
|
+
rootHandler.setFormatter(ColourizedFormatter(fmt="%(levelprefix)s %(message)s"))
|
|
64
|
+
|
|
65
|
+
if base_dn is not None:
|
|
58
66
|
settings.BASE_DN = base_dn
|
|
59
67
|
|
|
60
68
|
uvicorn.run(
|
|
61
69
|
"ldap_ui.app:app",
|
|
62
|
-
log_level=
|
|
70
|
+
log_level=logging.INFO,
|
|
63
71
|
host=host,
|
|
64
72
|
port=port,
|
|
65
73
|
)
|
ldap_ui/app.py
CHANGED
|
@@ -41,10 +41,12 @@ from .ldap_helpers import WITH_OPERATIONAL_ATTRS, empty, ldap_connect, unique
|
|
|
41
41
|
|
|
42
42
|
LOG = logging.getLogger("ldap-ui")
|
|
43
43
|
|
|
44
|
-
if settings.BASE_DN
|
|
44
|
+
if not settings.BASE_DN:
|
|
45
45
|
LOG.critical("An LDAP base DN is required!")
|
|
46
46
|
sys.exit(1)
|
|
47
47
|
|
|
48
|
+
LOG.debug("Base DN: %s", settings.BASE_DN)
|
|
49
|
+
|
|
48
50
|
# Force authentication
|
|
49
51
|
UNAUTHORIZED = Response(
|
|
50
52
|
"Invalid credentials",
|
|
@@ -96,8 +98,10 @@ class LdapConnectionMiddleware(BaseHTTPMiddleware):
|
|
|
96
98
|
return UNAUTHORIZED
|
|
97
99
|
|
|
98
100
|
except ldap.LDAPError as err:
|
|
101
|
+
msg = ldap_exception_message(err)
|
|
102
|
+
LOG.error(msg)
|
|
99
103
|
return PlainTextResponse(
|
|
100
|
-
|
|
104
|
+
msg,
|
|
101
105
|
status_code=500,
|
|
102
106
|
)
|
|
103
107
|
|
|
@@ -155,6 +159,10 @@ class CacheBustingMiddleware(BaseHTTPMiddleware):
|
|
|
155
159
|
async def http_exception(_request: Request, exc: HTTPException) -> Response:
|
|
156
160
|
"Send error responses"
|
|
157
161
|
assert exc.status_code >= 400
|
|
162
|
+
if exc.status_code < 500:
|
|
163
|
+
LOG.warning(exc.detail)
|
|
164
|
+
else:
|
|
165
|
+
LOG.error(exc.detail)
|
|
158
166
|
return PlainTextResponse(
|
|
159
167
|
exc.detail,
|
|
160
168
|
status_code=exc.status_code,
|
|
@@ -169,7 +177,7 @@ async def forbidden(_request: Request, exc: ldap.LDAPError) -> Response:
|
|
|
169
177
|
|
|
170
178
|
async def http_422(_request: Request, e: ValidationError) -> Response:
|
|
171
179
|
"HTTP 422 Unprocessable Entity"
|
|
172
|
-
LOG.
|
|
180
|
+
LOG.warn("Invalid request body", exc_info=e)
|
|
173
181
|
return Response(repr(e), status_code=422)
|
|
174
182
|
|
|
175
183
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
ldap_ui/__init__.py,sha256=
|
|
2
|
-
ldap_ui/__main__.py,sha256=
|
|
3
|
-
ldap_ui/app.py,sha256=
|
|
1
|
+
ldap_ui/__init__.py,sha256=ORAtCCI2THBDcdzIbh6oBsoshDvkkmXUWpmO4Q5McAk,22
|
|
2
|
+
ldap_ui/__main__.py,sha256=w-k8oMOjFrcBd9vsOp3BbIqnMdYPZrz1Y5T5Nd-ZPrk,1653
|
|
3
|
+
ldap_ui/app.py,sha256=I_JuRLYYy-zeMzvDMqVQMshzP_PFDLMAMlFoRgEgR6M,6945
|
|
4
4
|
ldap_ui/ldap_api.py,sha256=l6Wnjzm8ycaY-xXT2JNuHTTvLEsOEXGJnJhDdD72N5Q,13267
|
|
5
5
|
ldap_ui/ldap_helpers.py,sha256=DRpKtqEX_OvYJBuvzTNi0CcZAu446wwUiOezlkBAxrQ,3045
|
|
6
6
|
ldap_ui/schema.py,sha256=apbdLK_WpED0IzmrdktWTu4ESz8GfdOoJuRicFC84YY,3327
|
|
@@ -16,9 +16,9 @@ ldap_ui/statics/assets/index-CA45Sb-q.js,sha256=qejoldzV9wbUVar1ljURYwyTb2DYn3HQ
|
|
|
16
16
|
ldap_ui/statics/assets/index-CA45Sb-q.js.gz,sha256=1yJTHdcLZLU2d6DkPKbmNEFiOlPo7vIWXYyg_fidSdE,43710
|
|
17
17
|
ldap_ui/statics/assets/index-DlTKbnmq.css,sha256=Rpthz_HvUybqmodfPCnOXFsSwGd7v8hhh-p-duAzf1E,48119
|
|
18
18
|
ldap_ui/statics/assets/index-DlTKbnmq.css.gz,sha256=Ctq3hMh_BBVt9zsh9CYlHpVtDDHanicyGPAdcGXIFXw,11532
|
|
19
|
-
ldap_ui-0.9.
|
|
20
|
-
ldap_ui-0.9.
|
|
21
|
-
ldap_ui-0.9.
|
|
22
|
-
ldap_ui-0.9.
|
|
23
|
-
ldap_ui-0.9.
|
|
24
|
-
ldap_ui-0.9.
|
|
19
|
+
ldap_ui-0.9.5.dist-info/LICENSE.txt,sha256=UpJ0sDIqHxbOtzy1EG4bCHs9R_99ODxxPDK4NZ0g3I0,1042
|
|
20
|
+
ldap_ui-0.9.5.dist-info/METADATA,sha256=H0qL_U6JgHRSyKW5aK_vUkfULMjjM0abbJQmHR8IKC4,7557
|
|
21
|
+
ldap_ui-0.9.5.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
22
|
+
ldap_ui-0.9.5.dist-info/entry_points.txt,sha256=TGxMkXYeZP5m5NjZxWmgzITYWhSdj2mR_GGUYmHhGws,50
|
|
23
|
+
ldap_ui-0.9.5.dist-info/top_level.txt,sha256=t9Agyig1nDdJuQvx_UVuk1n28pgswc1BIYw8E6pWado,8
|
|
24
|
+
ldap_ui-0.9.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|