+ 7

Question regarding firebase rules

I had a firebase code in sololearn which votes for some things (for examples programming languages). But I had to make it private because some users manually write the program and submit results with spamming and bad words. Therefore I tried to solve that problem using configuring the firebase rules. Most of the rules are working but I want to know if the value submitted is an array. For example reference.update(["java","c"]) //valid reference.update(true) //invalid Many examples in google are not working

16th Feb 2019, 10:26 AM
Seniru
Seniru - avatar
10 Respostas
+ 12
Seniru Pasan Look here regarding saving arrays https://firebase.googleblog.com/2014/04/best-practices-arrays-in-firebase.html?m=1 Now, are you trying to determine using the rules if the value is an array? if so, maybe this will help https://stackoverflow.com/questions/45292073/validate-if-the-newdata-is-an-array-with-firebase-database-rules
16th Feb 2019, 11:02 AM
Burey
Burey - avatar
+ 7
Yeah, I was looking at the same post as Burey 😅 Here an implementation: https://code.sololearn.com/WlYlti3Ejg3v/?ref=app
16th Feb 2019, 11:16 AM
Martin Möhle
Martin Möhle - avatar
+ 5
Have you reported the spamming and foul language to moderators/sololearn? You can block/report rogue users on this platform.
18th Feb 2019, 7:21 AM
Sonic
Sonic - avatar
+ 4
Seniru Pasan So what is your intention? It might help if you share the code
16th Feb 2019, 3:45 PM
Martin Möhle
Martin Möhle - avatar
+ 2
Burey Coder Martin Madhav can u help?
16th Feb 2019, 10:27 AM
Seniru
Seniru - avatar
+ 1
Martin I have tried newData.child(0).exists() before. But it won't work as intended
16th Feb 2019, 3:38 PM
Seniru
Seniru - avatar
+ 1
Code is here https://code.sololearn.com/WLrWDQWTIHhd/?ref=app I have to turn on the computer to get the rules.
16th Feb 2019, 3:48 PM
Seniru
Seniru - avatar
+ 1
Coder i want to check the updated value is an array using firebase rules. More info in top.
17th Feb 2019, 5:33 AM
Seniru
Seniru - avatar
+ 1
Coder lol it was in that blog post
17th Feb 2019, 6:13 AM
Seniru
Seniru - avatar
+ 1
Sonic then most of the users will be blocked 😆. The best thing is to configure rules. So no extra work for mods . And also there is no way of finding the username of a user in my app
18th Feb 2019, 2:01 PM
Seniru
Seniru - avatar