-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
22 lines (19 loc) · 853 Bytes
/
Copy pathfirestore.rules
File metadata and controls
22 lines (19 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users collection: public create, authenticated read/update
match /users/{userId} {
// Anyone can create a user document (for signup)
allow create: if true;
// Only authenticated users can read their own document
allow read: if request.auth != null && request.auth.uid == userId;
// Only authenticated users can update their own document
allow update: if request.auth != null && request.auth.uid == userId;
}
// Flights collection: authenticated users only
match /flights/{flightId} {
allow read, write: if request.auth != null && request.auth.uid == resource.data.userId;
allow create: if request.auth != null && request.auth.uid == request.resource.data.userId;
}
}
}