Allow creation of api keys scoped to functions

This commit is contained in:
Peter Stockings
2025-11-20 19:44:00 +11:00
parent 7241c4803f
commit f0d63bed22
2 changed files with 20 additions and 4 deletions

View File

@@ -18,14 +18,18 @@ def api_keys():
if isinstance(key['scopes'], str):
key['scopes'] = json.loads(key['scopes'])
# Fetch user's functions for scoping
functions = db.get_http_functions_for_user(user_id)
if htmx:
return render_block(
environment,
"dashboard/settings/api_keys.html",
"page",
api_keys=api_keys
api_keys=api_keys,
functions=functions
)
return render_template("dashboard/settings/api_keys.html", api_keys=api_keys)
return render_template("dashboard/settings/api_keys.html", api_keys=api_keys, functions=functions)
@settings.route("/api-keys", methods=["POST"])
@login_required