Skip to content

Commit 74eb0ef

Browse files
authored
Update README.md
1 parent b378b8e commit 74eb0ef

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,33 @@ REACT_APP_CONFIRMATION_EMAIL_REDIRECT=http://localhost:3000
110110
REACT_APP_CONFIRMATION_EMAIL_REDIRECT=https://mydomain.com
111111
```
112112

113+
### Security Rules
114+
115+
```
116+
{
117+
"rules": {
118+
".read": false,
119+
".write": false,
120+
"users": {
121+
"$uid": {
122+
".read": "$uid === auth.uid || root.child('users/'+auth.uid).child('roles').hasChildren(['ADMIN'])",
123+
".write": "$uid === auth.uid || root.child('users/'+auth.uid).child('roles').hasChildren(['ADMIN'])"
124+
},
125+
".read": "root.child('users/'+auth.uid).child('roles').hasChildren(['ADMIN'])",
126+
".write": "root.child('users/'+auth.uid).child('roles').hasChildren(['ADMIN'])"
127+
},
128+
"messages": {
129+
".indexOn": ["createdAt"],
130+
"$uid": {
131+
".write": "data.exists() ? data.child('userId').val() === auth.uid : newData.child('userId').val() === auth.uid"
132+
},
133+
".read": "auth != null",
134+
".write": "auth != null",
135+
},
136+
}
137+
}
138+
```
139+
113140
## Setup via Gatsby CLI
114141

115142
* `gatsby new react-gatsby-firebase-authentication git@github.com:the-road-to-react-with-firebase/react-gatsby-firebase-authentication.git`

0 commit comments

Comments
 (0)