Question regarding firebase rules | Sololearn: Learn to code for FREE!

+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

2/16/2019 10:26:05 AM

Seniru

11 Answers

New Answer

+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

+7

Yeah, I was looking at the same post as Burey 😅 Here an implementation: https://code.sololearn.com/WlYlti3Ejg3v/?ref=app

+5

Have you reported the spamming and foul language to moderators/sololearn? You can block/report rogue users on this platform.

+4

Seniru Pasan So what is your intention? It might help if you share the code

+2

Burey Coder Martin Madhav can u help?

+1

Martin I have tried newData.child(0).exists() before. But it won't work as intended

+1

Code is here https://code.sololearn.com/WLrWDQWTIHhd/?ref=app I have to turn on the computer to get the rules.

+1

Coder i want to check the updated value is an array using firebase rules. More info in top.

+1

Coder lol it was in that blog post

+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