Skip to content

Commit

Permalink
Clarify expiry of security rules for banned users (#167)
Browse files Browse the repository at this point in the history
Fixes #158
  • Loading branch information
ekzhang authored Dec 22, 2024
1 parent 7b5bdcc commit 0ac422b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions database.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rules": {
"games": {
"$gameId": {
".read": "auth != null && !root.child('users').child(auth.uid).child('banned').exists()",
".read": "auth != null && (!root.child('users').child(auth.uid).child('banned').exists() || root.child('users').child(auth.uid).child('banned').val() < now)",
"startedAt": {
".write": "auth != null && auth.uid == data.parent().child('host').val() && !data.exists() && newData.exists()",
".validate": "newData.isNumber() && newData.val() == now"
Expand Down Expand Up @@ -102,7 +102,7 @@
},
"chats": {
"$chatId": {
".read": "auth != null && !root.child('users').child(auth.uid).child('banned').exists()",
".read": "auth != null && (!root.child('users').child(auth.uid).child('banned').exists() || root.child('users').child(auth.uid).child('banned').val() < now)",
".indexOn": ["time", "user"],
"$messageId": {
".write": "auth != null && ((!data.exists() && newData.exists()) || (data.exists() && root.child('users').child(auth.uid).child('admin').val() == true))",
Expand All @@ -123,7 +123,7 @@
}
},
"lobbyChat": {
".read": "auth != null && !root.child('users').child(auth.uid).child('banned').exists()",
".read": "auth != null && (!root.child('users').child(auth.uid).child('banned').exists() || root.child('users').child(auth.uid).child('banned').val() < now)",
".indexOn": ["time", "user"],
"$messageId": {
".write": "auth != null && ((!data.exists() && newData.exists()) || (data.exists() && root.child('users').child(auth.uid).child('admin').val() == true))",
Expand Down

0 comments on commit 0ac422b

Please sign in to comment.