title: How to protect a Firebase Node depending on sibling Node?
body: <p>I need to implement some rules in Firebase to protect my data.</p>
  
  <p>Let's say I have node <strong>a</strong> and node <strong>b</strong>. The structure is as follows:</p>
  
  <pre><code>{
      a:
      [
          a1: {uid: 123},
          a2: {uid: 321},
          a3: {uid: 567}
      ],
      b:
      [
          a1: {data: 'foo.bar'},
          a2: {data: 'foo.bar'},
          a3: {data: 'foo.bar'}
      ]
  }
  </code></pre>
  
  <p>As in the example above, the <em>child nodes</em> of <strong>a</strong> are the <em>keys</em> of node <strong>b</strong>. How can I restrict the access to <strong>data</strong> of node <strong>b</strong> depending on the <strong>uid</strong> of node <strong>a</strong>?</p>
  
  <p>For example. The <em>user</em> with <strong>uid</strong> 123 in the node <strong>a</strong>, his key is <strong>a1</strong>, so, in node <strong>b</strong> only can retrieve data from child node <strong>a1</strong> (b -> a1).</p>