How to block users in firebase?

Viewed 844

I am using firestore database, in which there is a root collection posts. To block a user I created a function in which the blocked user's user id get's stored in the sub collection of the current user id subcollection, below is the document reference

DocumentReference docref = Firestore.instance.collection("users").document(currentUserId).collection("blocked_ids").document(blockeduserID);

Now the feed is retrieved from the root collection of posts which is referred as below

Collection ref = Firestore.instance.collection("posts");

Now I want to configure the security rules for the firestore database, so that the posts of the blocked ids is not visible to the current user.

How the security rules can be configured in this case to filter the blocked users and represent the data to the current user?

0 Answers
Related