-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirestore.rules
More file actions
27 lines (25 loc) · 1.02 KB
/
firestore.rules
File metadata and controls
27 lines (25 loc) · 1.02 KB
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Activities collection - users can only read/write their own activities
match /activities/{activityId} {
allow read, write: if request.auth != null &&
(request.auth.uid == resource.data.sellerId ||
request.auth.uid == request.resource.data.sellerId);
allow create: if request.auth != null &&
request.auth.uid == request.resource.data.sellerId;
}
// Listings collection
match /listings/{listingId} {
allow read: if true; // Anyone can read listings (for buyers)
allow write: if request.auth != null &&
request.auth.uid == resource.data.user_id;
allow create: if request.auth != null &&
request.auth.uid == request.resource.data.user_id;
}
// Users collection
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}