-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathfirestore.rules
More file actions
31 lines (25 loc) · 911 Bytes
/
firestore.rules
File metadata and controls
31 lines (25 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
service cloud.firestore {
match /databases/{database}/documents {
function dbData(type, document) {
return get(/databases/$(database)/documents/$(type)/$(document)).data
}
match /users/{userId}/data/{document=**} {
allow read, write: if request.auth.uid == userId;
}
match /users/{userId}/customData/{document=**} {
allow read, write: if request.auth.uid == userId;
}
match /{db}/{document} {
allow create: if request.auth.uid != null;
allow read: if request.auth.uid != null;
allow write, delete: if request.auth.uid in dbData(db, document).write;
match /data/{type} {
allow read: if request.auth.uid != null;
allow write, delete: if request.auth.uid in dbData(db, document).write;
}
}
match /userDB/{document} {
allow write: if request.resource.data.uid == request.auth.uid;
}
}
}