title: Firestore global security rules
body: <p>In my application I would love to have global security rules that apply to all paths, if those rules fail then request should be denied, if they pass then follow to check the next set of rules defined by the next level. As far as the documentation said, if there are multiple matches, then they are OR conditions, so as long as if one of them returns true then permission is granted.  Is there a way to have the conditions AND instead of OR ?</p>
  <p>Currently I'm defining functions at each level and making sure to call them from whatever inner match, while it works, the rules become quite annoying to manage.</p>
  <p>-----edit------</p>
  <p>Here's an example that I want to achieve.
  When a user tried to read a document, there are global read rules such as</p>
  <pre><code>function globalGetRules(){return request.auth != null &amp;&amp; resource.data.deleted != true;}
  </code></pre>
  <p>Then each collection might have extra rules to apply such as</p>
  <pre><code>function someResourceGetRules(){return resource.data.draft != true || resource.data.owner == request.auth.uid;}
  </code></pre>
  <p>then what I do is for that resource</p>
  <pre><code>allow get: if globalGetRules() &amp;&amp; someResourceGetRules();
  </code></pre>
  <p>What I'm looking for is a way to force globalGetRules on all resources, then after it passes, someResourceGetRules should be validated, which also could be nested (future plans, currently it's 1 level only)</p>