【问题标题】:Llimit count of data reads per user firebase and firestore in flutter限制 Flutter 中每个用户 firebase 和 firestore 读取的数据计数
【发布时间】:2021-01-06 22:44:32
【问题描述】:

我正在开发一个应用程序,该应用程序通过 Firebase 向注册用户提供托管在 AWS 虚拟机上的业务报告,并在 Firestore 中提供用户配置文件。每次用户进行查询时,其 Firestore 配置文件中的查询数量都会增加(附加代码)。我需要用户每天的查询不能超过 10 次。我该怎么做?

代码:

child: FlatButton(
        color: Colors.transparent,
        child: Text(
          'Process',
          style: TextStyle(color: Colors.white),
        ),
        onPressed: () async {
          final FirebaseUser user =
              await _auth.currentUser();

          var loginSuccess = await model
              .getdata(_inputCuit.text);
          if (loginSuccess) {
            
            Firestore.instance
                .collection("users")
                .document(user.uid)
                .updateData({
              "queries": FieldValue.increment(1)
            });

            
            Navigator.pushNamed(context, 'post',
                arguments: model.info);

enter image description here

【问题讨论】:

    标签: firebase flutter google-cloud-firestore firebase-authentication


    【解决方案1】:

    安全规则无法限制用户的读取次数。如果这是您的用例的要求,您必须在 Cloud Functions 或其他一些受信任的环境中实现读取。

    【讨论】:

      猜你喜欢
      • 2020-04-09
      • 2020-11-05
      • 2021-08-21
      • 1970-01-01
      • 2021-11-08
      • 2021-08-27
      • 2020-10-20
      • 2021-08-02
      • 1970-01-01
      相关资源
      最近更新 更多