-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirestore.rules
38 lines (36 loc) · 1.46 KB
/
firestore.rules
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
32
33
34
35
36
37
38
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// This rule allows anyone with your Firestore database reference to view, edit,
// and delete all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// all client requests to your Firestore database will be denied until you Update
// your rules
match /games/{gameId} {
match /matchVersion {
allow create: if request.auth.uid == request.resource.data.hostUser;
allow update: if request.auth.uid == resource.data.hostUser;
allow read: if true;
}
match /gameMatches {
allow create: if request.auth.uid == request.resource.data.hostUser;
allow read: if true;
}
allow create: if request.auth.uid == request.resource.data.hostUser;
allow update: if request.auth.uid == resource.data.hostUser;
allow read: if true;
match /players/{playerId} {
allow create: if request.auth.uid == request.resource.data.userId;
allow update: if request.auth.uid == resource.data.userId;
allow read: if true;
}
match /matches/{matchId} {
allow read, write: if true;
}
}
}
}