简体   繁体   English

Flutter 中每个用户 firebase 和 firestore 的数据读取次数限制

[英]Llimit count of data reads per user firebase and firestore in flutter

I am developing an application that provides business reports hosted on an AWS virtual machine to registered users through Firebase with a user profile in Firestore.我正在开发一个应用程序,该应用程序通过 Firebase 使用 Firestore 中的用户配置文件向注册用户提供托管在 AWS 虚拟机上的业务报告。 Each time the user makes a query, the number of queries increases in his Firestore profile (code attached).用户每次进行查询时,其 Firestore 配置文件(附代码)中的查询数量都会增加。 I would need that users can not make more than 10 daily queries .. how can I do it?我需要用户每天查询不能超过 10 次.. 我该怎么做?

code :代码 :

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在此处输入图片说明

There is no way in security rules to limit the number of reads a user makes.安全规则无法限制用户读取的次数。 If that is a requirement for your use-case, you'll have to implement the reads in Cloud Functions or some other trusted environment.如果这是您的用例的要求,则您必须在 Cloud Functions 或其他一些受信任的环境中实现读取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM