title: Firebase Rules don't work
body: <p>I am Developing an App where you live in a flat and have roommates, now I'm trying to disable access for all users that don't live in that flat.</p>
  
  <p>Here are my Rules: </p>
  
  <pre><code>{
    "rules": {
      // no access 
      ".read": "false",
      ".write": "false",
        "Users" : {
        "$userID" : {
          //read on User Folder for all Users 
          ".read" : "auth != null",
          //write only for the user itself 
          ".write" : "$userID === auth.uid"
        }
      },
      "Flat" : {
        "$flatID" : {
          //Flat (identified through flatID) can only be accessed, if you are a roommate 
          ".read" : "$flatID === root.child('Users').child(auth.uid).child('flatID').val()",
          ".write" : "$flatID === root.child('Users').child(auth.uid).child('flatID').val()"
        }
      }
    }
  }
  </code></pre>
  
  <p>My Database looks somewhat like this: </p>
  
  <pre><code>root
  .Users 
  ..uID
  ...(data) 
  ...flatID : number 
  .Flat 
  ..flatID 
  ...(data) 
  </code></pre>
  
  <p>So the flatID of that User is stored in his "folder" at root/Users/uID/flatID, which I try to get here: <code>root.child('Users').child(auth.uid).child('flatID').val()</code> and then I check it with the "folder" flatID.</p>
  
  <p>Now if I try to write any Data into the flat, I don't have the right permission, and I cannot find my error. 
  The Users/userID rule is working fine</p>
  
  <p>Thanks in advance :) </p>
  
  <p>Edit: </p>
  
  <p>The Data looks like this: </p>
  
  <pre><code>root 
  _Flat 
  __1 
  ___name : "asdf" 
  __2
  ___(more Flats, for the Problem we only need one) 
  _Users 
  __F8XpTmxfIzYzrEY92alBOnx5eTO2 (Auth ID) 
  ___flatID : 1 
  __nextUserID
  ___NextUserData 
  </code></pre>
  
  <p>My Java Code to edit the flatname is: </p>
  
  <pre><code>fref.child("Flat").child(flatID).child("name").setValue(flatNameInput.getText().toString())
  </code></pre>
  
  <p>The <code>flatID</code> is a variable with the flatID for that user</p>