Firebase Rules permission denied but why? -


this rules:

{   "rules": {     "freecoinsrequest":{       ".read": false,         ".write": "       newdata.child('uid').val() == auth.uid         1. && (root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').val() < - 10000         2. || !root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').exists())        " ,       "uid":{         ".validate" : true       },         "$other":{           ".write": false,           ".validate": false         }     },   } } 

so user should able write path if:

  • the json contains "uid" key, , uid value
  • he did not write server/lasttimetookfreecoins within 10 seconds ago or
  • he never wrote server/lasttimetookfreecoins

i can not understand why gets denied in simulator. when uncomment 1 , 2, seen in rules, works.

thanks.

in testing, rules produced desired results when /users/$uid/server/lasttimetookfreecoins existed failed when did not. reversing order of conditions fixed that:

  newdata.child('uid').val() == auth.uid      && (!root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').exists()     || root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').val() < - 10000) 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -