How to make FlutterFire query constraints match security rules constraints?

Viewed 60

I have written then following security rule in Firebase. The problem is that I'm not sure how to match the query constraints match the security rules constraints. Can anyone help me ?

//Firebase rule 

rules_version = '2';
           service cloud.firestore {
             match /databases/{database}/documents {
               match /projects/{projectID} {
                 allow read, write: if request.auth != null && exists(/databases/$(database)/documents/projects/{projectID}/members/$(request.auth.uid));
            }
          }
        }

//My query looks like this so far:

  Stream<List<ProjectModel>> getUserList() {
    return FirebaseFirestore.instance.collection('projects').snapshots().map(
        (snapShot) => snapShot.docs
            .map((document) => ProjectModel(
                name: document.data()['name'],
                owner: document.data()['owner'],
                description: document.data()['description']))
            .toList());
  }
0 Answers
Related