gpt4 book ai didi

firebase - 允许根据文档中的时间戳值读取 FireStore 规则

转载 作者:行者123 更新时间:2023-12-03 06:26:29 24 4
gpt4 key购买 nike

我想创建一个 FireStore 规则,在当前日期超过文档中的时间戳值后授予文档读取权限。

这是一个博客网络应用程序。例如,博主将博客文章设置为在特定日期向公众开放。

从阅读文档来看,这应该可行,但事实并非如此。

service cloud.firestore {
match /databases/{database}/documents {
match /Articles/{article}{
allow read: if request.time.date() < resource.data.date
}
}
}

我缺少什么?

最佳答案

此处为 firebaser

我不久前尝试过同样的事情,但发现目前不可能。

可以根据特定文档的属性来允许/拒绝读取该文档。

可以允许查询根据文档中的属性过滤文档,但目前只能基于 request.auth

不幸的是,这意味着您的过滤器目前无法通过安全规则实现。我推荐你file a feature request插话。

更新 (2018-04-24):现在可能可以通过request.time实现,但我还没有有机会测试一下。看看here .

关于firebase - 允许根据文档中的时间戳值读取 FireStore 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47414073/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com