如何获取列表类型查询的Firestore安全规则阵列限制的值?

发布于 2025-01-27 12:54:50 字数 1025 浏览 3 评论 0原文

我正在制作一个查询,例如db.Collection('eaccept')。其中('access.users','array-contains',[user1.ref])

user1.ref 是documentReference对用户集合中的文档中的一个,该文档使该用户能够读取此帐户及其子收集,例如

firebase安全规则模拟器中的ACL,如果我调试属性resource.data.access.users我可以看到那是类型benter> constraint_value。而且我可以看到我传递的数组的值:

constraint_value {
  simple_constraints {
    comparator: LIST_CONTAINS
    value {
      path_value {
        segments {
          simple: "databases"
        }
        segments {
          simple: "(default)"
        }
        segments {
          simple: "documents"
        }
        segments {
          simple: "users"
        }
        segments {
          simple: "account-1"
        }
      }
    }
  }
}

但是如何在安全规则中获取此Condect_value hasonly()或hasall()的列表方法检查权限,

没有value属性或value> value()方法和实际上constraint_value文档中没有任何类型的接口。

I am making a query like db.collection('accounts').where('access.users', 'array-contains', [ user1.ref ])

user1.ref is a DocumentReference to a document in the users collection that enables this user to read this account and its child collections, like an ACL

In the Firebase security rules emulator, if I debug the property resource.data.access.users I can see that is type constraint_value. And I can see the value for the array I passed:

constraint_value {
  simple_constraints {
    comparator: LIST_CONTAINS
    value {
      path_value {
        segments {
          simple: "databases"
        }
        segments {
          simple: "(default)"
        }
        segments {
          simple: "documents"
        }
        segments {
          simple: "users"
        }
        segments {
          simple: "account-1"
        }
      }
    }
  }
}

But how can I get the actual LIST value (in this case a LIST of of user references) of this constraint_value in the security rules so that I can check permissions using a LIST method like hasOnly() or hasAll()

There is no value property or value() method and in fact constraint_value isn't any type of interface in the docs ....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文