How do I give read/write access to all nodes with Firebase rules? -
default setting gives full access:
{ "rules": { ".read": true, ".write": true } }
for sake of testing understanding of rule-writing firebase guide , documentation, i'm (now retreating to) trying achieve same results writing rules 4 parent nodes.
if makes difference, first 2 nodes have values, no children. **sidequest: still called nodes?
the rules below cause same behavior when rules above changed false read , write.
{ "rules": { "mynode1": { ".read" : true, ".write" : true }, "mynode2" : { ".read" : true, ".write" : true }, "mynode3" : { ".read" : true, ".write" : true }, "mynode4" : { ".read" : true, ".write" : true } } }
what wrong rules?
update/context:
i have authdatacallback stops running here (within if (authdata) {
clause):
var ref = new firebase("https://<my>.firebaseio.com") ref.once("value", function(snapshot){
found if change ref var more specific: var ref = new firebase("https://<my>.firebaseio.com/mynode1")
, authdatacallback runs in entirety.
surely won't necessary produce snapshots of entire database; confused way of getting data need. i've updated, i'm still confused why rules held callback considering gave read , write whole database.
i think answer based on info provided:
the 2 sets of rules posted different. first set
{ "rules": { ".read": true, ".write": true } }
allows read , write access every node, including parent node, within firebase @
https://<my>.firebaseio.com
the second set of rules allows access specific nodes within firebase reference blocks access other nodes including access parent node. in update code trying read parent node has no rules defined default read , write false.
so have following structure:
https://whirlygig.firebaseio.com whirlygig somerandomdata: "3.141" otherrandomdata: "6.02" mynode1 firstname: "first" lastname: "last" mynode2 first: "first" last: "last"
with first set of rules, can access somerandomdata mynode1, mynode2 etc.
with second set of rules, can access mynode1 , mynode2 cannot access somerandomdata
Comments
Post a Comment