Firebase Rules: What is .contains()? -
i have read through firebase documentation , not understand .contains()
.
below sample rules firebase database in documentation:
{ "rules": { "rooms": { "$room_id": { "topic": { // room's topic can changed if room id has "public" in ".write": "$room_id.contains('public')" } } } } }
may know $room_id.contains('public')
?
is referred child of $room_id
?
$room_id
matched wildcard key name appears parent of "topic". rule allowing writes if key name contains string "public" anywhere in it.
so, if tried change value of /rooms/public_roomid/topic
value, allowed. however, write of /rooms/roomid/topic
rejected.
Comments
Post a Comment