Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a firebase security rule to only allow appending to a list?

I'd like to create a simple chat app, but I don't want any user to be able to edit the chat-entry list - but I do want any user to be able to append to it. Is this possible?

like image 625
Chris2048 Avatar asked Jul 21 '13 18:07

Chris2048


1 Answers

You can utilize exists in your write rule:

"chat_list": {
   "$chat_entry": {
       ".write": " !data.exists() "
   }
}

This will make it possible to append but not to write to a record which already exists.

like image 104
Kato Avatar answered Jun 19 '23 07:06

Kato