title: Let user access to their own data in firebase
body: <p>I have user associated with each data, </p>
  
  <p><img src="https://i.stack.imgur.com/SMTam.png" alt="data model pic"></p>
  
  <p>and rule defines as below-</p>
  
  <pre><code>{
    "rules": {
      ".read": false,
      ".write": false,
      "expenses": {
        ".read": "auth.uid === data.child('userId').val()",
        ".write": "auth.uid === data.child('userId').val()"
      },
      "categories": {
          ".read": "auth != null",
          ".write": "auth != null"
      }
    }
  }
  </code></pre>
  
  <p>I have a requirement that the user can only read the data where their userId is associated.</p>
  
  <p>function to get Data- </p>
  
  <pre><code>getExpense():AngularFireList&lt;ExpenseData&gt;{
     if (!this.userId) return;
     this.expenses = this.db.list(`expenses`);
     return this.expenses
  }
  
  
  
  getCategory():AngularFireList&lt;CategoryData&gt;{
     if (!this.userId) return;
     this.categories = this.db.list('categories');
     return this.categories;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>ERROR Error: permission_denied at /expenses: Client doesn't have permission to access the desired data.</p>
  </blockquote>