Change API key checking on-request to match what the values should be in the
database (dict of '{"name": , "permissions": }')
This commit is contained in:
parent
a943e69cee
commit
a0e86f79c3
1 changed files with 2 additions and 1 deletions
|
@ -23,7 +23,8 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||||
hook = hooks[0]
|
hook = hooks[0]
|
||||||
authenticated = hook.get_kwarg("authenticated", True)
|
authenticated = hook.get_kwarg("authenticated", True)
|
||||||
key = params.get("key", None)
|
key = params.get("key", None)
|
||||||
permissions = _bot.get_setting("api-key-%s" % key, [])
|
key_setting = = _bot.get_setting("api-key-%s" % key, {})
|
||||||
|
permissions = key_seting.get("permissions", [])
|
||||||
|
|
||||||
if not authenticated or path in permissions or "*" in permissions:
|
if not authenticated or path in permissions or "*" in permissions:
|
||||||
if path.startswith("/api/"):
|
if path.startswith("/api/"):
|
||||||
|
|
Loading…
Reference in a new issue