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

@ -8,7 +8,6 @@
"name": "learnhouse",
"version": "0.1.0",
"dependencies": {
"crypto": "^1.0.1",
"framer-motion": "^7.3.6",
"next": "12.3.1",
"react": "18.2.0",
@ -1309,12 +1308,6 @@
"node": ">= 8"
}
},
"node_modules/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
"deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in."
},
"node_modules/css-box-model": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",
@ -4819,11 +4812,6 @@
"which": "^2.0.1"
}
},
"crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig=="
},
"css-box-model": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",

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 = []