Step23 Firestore security rules
Goal of this step
- Learn how to write Firestore security rules.
Overview
https://firebase.google.com/docs/firestore/security/overview
=> Flutter is "mobile" app so, we are using "Firestore Security Rules".
Get started
In this section, let's check "Get Started" Page.
https://firebase.google.com/docs/firestore/security/get-started
Writing rules
https://firebase.google.com/docs/firestore/security/get-started#writing_rules
Testing rules
https://firebase.google.com/docs/firestore/security/get-started#testing_rules
Deploying rules
https://firebase.google.com/docs/firestore/security/get-started#deploying_rules
Security Rules Basic
In this section, let's take a look at how to write basic security rules.
Basic read/write rules
https://firebase.google.com/docs/firestore/security/rules-structure#basic_readwrite_rules
*NOTE!
You cannot write rules like rest api(below).
Granular operations
https://firebase.google.com/docs/firestore/security/rules-structure#granular_operations
Hierarchical data
https://firebase.google.com/docs/firestore/security/rules-structure#hierarchical_data
Rules for our Flutter application
Real world posts "read" security rules
Let's fix meaningless collectionGroup posts rules.
*This is just a demo for security rules.
We are not going to implement publish and draft feature in Flutter side.
Refs and Memo Links
https://stackoverflow.com/questions/56149601/firestore-collection-group-query-on-documentid
https://stackoverflow.com/questions/56219469/firestore-get-the-parent-document-of-a-subcollection