单文档请求和查询请求有a limit of 10 get()。以下代码段将成为“标准”访问角色的访问次数为多少?
function isOwnerOfTeam(teamId, userId) {
return get(/databases/$(database)/documents/team_access_privilege/$(teamId)).data[userId] == 'OWNER'
}
function isAdminOfTeam(teamId, userId) {
return get(/databases/$(database)/documents/team_access_privilege/$(teamId)).data[userId] == 'ADMIN'
}
function isStandardOfTeam(teamId, userId) {
return get(/databases/$(database)/documents/team_access_privilege/$(teamId)).data[userId] == 'STANDARD'
}
function isTeamMember(teamId, userId) {
return isOwnerOfTeam(teamId, userId) || isAdminOfTeam(teamId, userId) || isStandardOfTeam(teamId, userId)
}
如果我有一个带有OR运算符的get()嵌套get()怎么办。那会打多少通电话?
例如
function getTeamId(teamName) {
get(/databases/$(database)/documents/team/$(teamName)).data[id]
}
match /teamSecretStory/{teamName} {
allow read: if isTeamMember(getTeamId(teamName), request.auth.uid);
}
总而言之,此get()嵌套的get()使用OR运算符对角色“ STANDARD”的访问次数是多少?
答案 0 :(得分:1)
与所有主要编程语言一样,安全规则从左至右短路其逻辑OR。从左到右评估每个OR,直到其中一个评估为true,或者所有评估为true。逻辑AND相同,除了第一次错误的评估会停止整个电路。