Fix more foreing key usages
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
Also refactors user info to class
This commit is contained in:
@@ -32,24 +32,17 @@ def view_users():
|
||||
@page_api.route("/cards", methods=["POST"])
|
||||
@check_api_key
|
||||
def get_group_cards():
|
||||
groups = request.json.get("groups", False)
|
||||
if not groups:
|
||||
request_groups = request.json.get("groups", False)
|
||||
if not request_groups:
|
||||
return "must specify groups in parameter", 400
|
||||
print(f"groups requested are: {groups}")
|
||||
print(f"groups requested are: {request_groups}")
|
||||
print(f"found users: {users}")
|
||||
gu = []
|
||||
keys = []
|
||||
for u in users:
|
||||
for gr in u["status"]["groups"]:
|
||||
group_name = f"{gr['prefix']}:{gr['name']}"
|
||||
print(f"prefix is {gr['prefix']}")
|
||||
print(f"name is {gr['name']}")
|
||||
print(f"group name is {group_name}")
|
||||
for group in groups:
|
||||
print(f"checking {group}")
|
||||
if group_name == group:
|
||||
gu.append(u)
|
||||
print(f"gu is: {gu}")
|
||||
keys = list(map(lambda u: u["metadata"]["name"], gu))
|
||||
for group in u.groups:
|
||||
if group in request_groups:
|
||||
keys.append(u.username)
|
||||
break
|
||||
print(f"keys are {keys}")
|
||||
flt = {
|
||||
"token.uid_hash": {"$exists": True},
|
||||
|
Reference in New Issue
Block a user