angularfire - Firebase Security Rules Nesting -
i creating reddit-type app. have array of stories, , each story has title, description, , votecount. want have separate .write rules votecount, structured rules -
"stories": { "$story_id": { "title": { ".write": "auth !== null" }, "description" { ".write": "auth !== null" }, "votecount": { ".write": "newdata.val() === data.val() + 1" }, } } this works existing stories.however, no longer allows me add new story, unless add .write rule directly $story_id node. , of course stops me having special .write rule votecount node.
any ideas on why happens?
so users have .write access on higher level, can write data follow specific rules?
you'll want put in .validation rule, instead of .write rule.
a simple way remember .write rules determine who can write data, while .validate rules determine what data can written.
Comments
Post a Comment