Firebase Firestore-安全规则:是多个读入或连接,并将评估;懒散地;?
所以我的问题是关于一个用例,当我的规则如下所示:Firebase Firestore-安全规则:是多个读入或连接,并将评估;懒散地;?,firebase,google-cloud-firestore,firebase-security,Firebase,Google Cloud Firestore,Firebase Security,所以我的问题是关于一个用例,当我的规则如下所示: match /collection/{docID} { allow read,write,update : if isSomethingTrue(); allow read: if request.auth.uid != null && isOnotherFunctionWithGETInside(); allow create: if request.auth.uid != null; } 如果我能将
match /collection/{docID} {
allow read,write,update : if isSomethingTrue();
allow read: if request.auth.uid != null && isOnotherFunctionWithGETInside();
allow create: if request.auth.uid != null;
}
如果我能将我的阅读规则翻译为:
allow read: isSomethingTrue() || (request.auth.uid != null && isOnotherFunctionWithGETInside())
如果是,那么如果isSomething()返回true,第二部分不会执行吗?那么它会在惰性模式下进行计算吗
这对我来说是一个重要的问题,因为如果我只交换两个allow read行的顺序(因为第二个read规则中的get()函数),账单(服务器读取操作)可能会有很大的不同
提前感谢。您描述的行为在编程语言中称为“短路”。是的,安全规则将短路逻辑OR,以避免计算表达式的其余部分。安全规则中包含了这一点。好的,太棒了。我知道ofc,但我学会了匈牙利语,他们称之为懒惰。就这些,谢谢你的清理。