fix: use wildcard role associations

This commit is contained in:
swve 2022-10-23 01:03:23 +02:00
parent 19b7dd650e
commit d0de935902
2 changed files with 4 additions and 15 deletions

View file

@ -38,9 +38,10 @@ async def verify_user_rights_with_roles(action: str, user_id: str, element_id: s
await check_database()
roles = learnhouseDB["roles"]
user_roles_cursor = roles.find({
"linked_users": str(user_id)
})
# find data where user_id is in linked_users or * is in linked_users
user_roles_cursor = roles.find({"$or": [{"linked_users": user_id}, {"linked_users": "*"}]})
user_roles = []