June 2018
Beginner to intermediate
394 pages
9h 2m
English
Unlike Real-time database rules, storage security rules follows a hierarchical structure. Read-write permission is usually granted to all files and directories. It allows developers to think of what rules need to be in place where and when. The rules control access to the content in the storage bucket.
There are three major keywords, allow, match, and if, using which we can apply rules to our storage bucket. The following rule is a typical example of how to write a condition for the path:
match /file/path/pattern { allow read, write: if <condition>;}
A single match statement can have multiple allow statements; this helps in checking multiple scenario-based conditions:
match /file/path/pattern ...
Read now
Unlock full access