angularjs - Firebase security rule for array of messages -
angularjs - Firebase security rule for array of messages -
i trying display list of messages based on recipient now, let's maintain simple. trying display list of messages.
my rule looks this
{ "rules": { "communications" : { "$communication":{ ".read" : true, ".write": true } } }
for reason though, application not want read it
fireref = new firebase(url); fireref.auth(my_token); commsref = fireref.child('communications') $scope.communications = $firebase(commsref)
it works if have rule looking like
{ "rules": { "communications" : { ".read" : true, ".write": true } }
but cause problem add together status on children node of communication. like:
{ "rules": { "communications" : { ".read" : true, ### rid of line , have kid handling ".write": true, "$communication":{ ".read" : "data.child('to').val() == auth.uid" } } }
i assuming because have $firebase on communications , needs read or write rules how event when new message added otherwise
thanks
with respect security rules, firebase operations all-or-nothing.
that means lists of info sent client never incomplete, or filtered views of finish server data. result, attempting load of info @ /communications
fail when using first set of security rules, though have permission read of info there governed kid rule @ /communications/$communication
.
to handle utilize case, consider restructuring info such each communication indexed recipient, i.e. /communications/$recipient/$communication
, simplify security rules.
additionally, create bucket read-only recipient (i.e. .read: auth.id == $recipient
) while allowing send message user (i.e. .write: auth != null && !data.exists()
). lastly rule ensures sending client authenticated , writing location not yet exist, such new force id.
angularjs firebase angularfire firebase-security
Comments
Post a Comment