Created
January 6, 2021 16:37
-
-
Save yunusemrecetin/683b796582bfca2224e722ba97aa44e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { // Root | |
".write": false, // everyone can't write | |
".read": false, // everyone can't read | |
"live": { // rooms of live | |
"rooms": { // root of rooms | |
".write": false, // everyone can't write | |
".read": false, // everyone can't read | |
"$room": { // channels of rooms (but this is a variable of each room) | |
".write": false, // everyone can't write | |
".read" : "auth != null", // only authenticated users are can read | |
"comments": { | |
".indexOn": ["date"], // We index basically the date | |
"$commentid" : { | |
".write": "!data.parent().parent().child('finish').exists() && !data.parent().parent().child('banned').child(auth.uid).exists() && data.parent().parent().exists() === true && !data.exists()", | |
".read": "auth != null", | |
// can send message | |
".validate" : "newData.hasChildren(['comment','uid','did','date','username','slug','authid'])", | |
// rules of comments | |
"comment" : { | |
".validate" : "newData.isString() && newData.val().length > 0 && newData.val().length < 500", | |
}, | |
"uid" : { | |
".validate" : "newData.val() === auth.uid" | |
}, | |
"did": { | |
".validate" : "newData.isNumber() && newData.val() > 0" | |
}, | |
"date": { | |
".validate" : "newData.isNumber() && newData.val() <= now", | |
}, | |
"username": { | |
".validate" : "newData.isString() && newData.val().length > 3" | |
}, | |
"slug" : { | |
".validate" : "newData.isString() && newData.val().length > 3" | |
}, | |
"authid" : { | |
".validate" : "newData.isNumber() && newData.val() > 0" | |
}, | |
"$other" : { | |
".validate" : false | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment