Add multiple groups querying
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-08-01 20:00:40 +03:00
parent 4f12c3efb2
commit ae54161c60

View File

@ -22,13 +22,13 @@ def view_users():
print(resp)
return jsonify(resp)
@page_api.route("/cards")
@page_api.route("/cards", methods=["POST"])
def get_group_cards():
group = request.args.get("group", False)
if not group:
return "must specify group in parameter", 400
print(group)
gu = list(filter(lambda u: any(g["name"] == group for g in u["status"]["groups"]), get_users()))
groups = request.json.get("groups", False)
if not groups:
return "must specify groups in parameter", 400
print(groups)
gu = list(filter(lambda u: any(g["name"] in groups for g in u["status"]["groups"]), get_users()))
keys = list(map(lambda u: u["metadata"]["name"], gu))
print(keys)
flt = {