-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirestore.rules
More file actions
23 lines (20 loc) · 797 Bytes
/
Copy pathfirestore.rules
File metadata and controls
23 lines (20 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Games collection
match /games/{gameId} {
// Anyone can read a game (to join or spectate)
allow read: if true;
// Anyone can create a new game
allow create: if true;
// Only players in the game can update it
allow update: if request.auth != null ||
request.resource.data.players.white.id == request.auth.uid ||
request.resource.data.players.black.id == request.auth.uid ||
// Allow unauthenticated updates for now (since we're using localStorage IDs)
true;
// Only allow deletion in development (you can tighten this later)
allow delete: if true;
}
}
}