【发布时间】:2020-05-03 22:06:36
【问题描述】:
您好,有没有实际增加这条规则的时间戳?我正在使用云火库
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// This rule allows anyone on the internet to view, edit, and delete
// all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// your app will lose access to your Firestore database
match /{document=**} {
allow read, write: if request.time < timestamp.date(2020, 1, 16);
}
}
}
上面写着 2020 年 1 月 16 日,如果低于这个数字,它将允许从我的数据库读取和写入数据。但它已经是 1 月 17 日在菲律宾。
我尝试将 timestamp.date 从 2020, 1, 16 更改为 2020, 3, 15,但我的 Flutter 应用仍然没有从数据库中读取任何内容。
我期望的是在我增加时间戳日期之后,它将允许我的应用程序从数据库中读取直到给定时间。现在即使我增加它,应用程序也不会从数据库中读取任何内容
这是我的代码:
@override
Widget build(BuildContext context) {
width = MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
backgroundColor: Color(0xFF0d192a),
appBar: CustomAppBar(height: 90),
drawer: DrawerNiVlad(),
body: ListView(
children: <Widget>[
ArlTitleText('EXPLORE V!'),
sb5,
HeaderCarousel(),
sb30,
ArlTitleText('DISCOUNT SECTION'),
sb5,
// DiscountWidget(),
sb30,
ArlTitleText('DUMMY SECTION'),
ArlBodyText('Lorem ipsum yes yes show boom tarat tarat yea boy Lorem ipsum yes yes show boom tarat tarat yea boy Lorem ipsum yes yes show boom tarat tarat yea boy'),
sb30,
],
),
),
);
}
部分内容:Discount 和 Dummy Sections 来自数据库,它不会出现,因为它在我的 vscode 中显示此错误:
还有一封来自 firebase 的电子邮件:
You chose to start developing in Test Mode, which leaves your Cloud Firestore database completely open to the Internet. Because your app is vulnerable to attackers, your Firestore security rules were configured to stop allowing requests after the first 30 days.
In 0 day(s), all client requests to your Firestore database will be denied. Before that time, please write strong security rules that allow your app to function while appropriately protecting your data. Analysis is run daily; if you've modified your rules in the last 24 hours those changes may not be accounted for.
【问题讨论】:
-
请编辑问题以显示执行查询的 dart 代码,但不能按您预期的方式工作。请务必检查错误并向我们显示错误消息是什么。同时向我们展示您尝试查询的数据以及您希望查询从该数据中返回的内容。
-
已更新,谢谢!我还包括错误和 firebase 发送的电子邮件
标签: firebase flutter google-cloud-firestore firebase-security