Pregunta

I would like to set the following rule in firebase security. To authorize write, I would like to make sure that the auth.user_id is the same as RulesDataSnapshot called "user_id" under the parent of the current branch

In order to do so, I tried writing the following write_rule:

".write": "auth.user_id == (data.parent().child('user_id').val())"

Firebase security API has a section on parent() method. https://www.firebase.com/docs/security/rulesdatasnapshot/parent.html

I used the parent() method as shown in the example. However, I recieve an error " No such method 'parent' "

Any help would be appreciated

¿Fue útil?

Solución

.parent() is a brand new feature and we accidentally deployed the docs for it before the actual implementation. :-) We just deployed the updated server code, so .parent() should work fine now. Give it another go!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top