title: Firebase Security & Rules, How can I let users delete their own data?
body: <p>My data in firebase looks like this, in my web app everyone who accesses it gets authenticated anonymously via firebase, and their UID is stored with every post the user creates:</p>
  
  <pre><code>  "-KF5N2V_dKD1dMHebUqc" : {
      "note" : "Hello everybody",
      "pos" : {
        "lat" : 40.3628851,
        "lng" : -74.0493175
      },
      "time" : 1460395853884,
      "uid" : "f8cf7863-5607-4e2b-97d7-6a121261466c"
    },
    "-KHwyP-tnWNOA3nxzEm4" : {
      "note" : "hi",
      "pos" : {
        "lat" : 37.0947156,
        "lng" : -121.0179501
      },
      "time" : 1463459362615,
      "uid" : "f8cf7863-5607-4e2b-97d7-6a121261466c"
    }
  </code></pre>
  
  <p>I want my firebase rules setup so that only anonymous users can delete their through own posts.</p>
  
  <p>So far i was only able to come up with this after reading the firebase documentation:</p>
  
  <pre><code>{
      "rules": {
        ".read": "auth != null",
        ".write": "auth != null",
        "$msg": {
          ".validate": "newData.hasChildren(['note','time','uid','pos']) 
            &amp;&amp; newData.child('note').isString() &amp;&amp; newData.child('time').isNumber() 
            &amp;&amp; newData.child('uid').isString() &amp;&amp; newData.child('note').isString()
            &amp;&amp; newData.child('pos/lat').isNumber() &amp;&amp; newData.child('pos/lng').isNumber()"
        }
      }
  }
  </code></pre>