-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
41 lines (35 loc) · 1.39 KB
/
firestore.rules
File metadata and controls
41 lines (35 loc) · 1.39 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow authenticated users to read and write their own user documents
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Allow authenticated users to read other users' basic profile info (for browsing)
match /users/{userId} {
allow read: if request.auth != null;
}
// Allow skill requests to be created and managed
match /skillRequests/{requestId} {
allow read, write: if request.auth != null &&
(request.auth.uid == resource.data.from_user ||
request.auth.uid == resource.data.to_user);
allow create: if request.auth != null && request.auth.uid == request.resource.data.from_user;
}
// Allow skill sessions
match /skillSessions/{sessionId} {
allow read, write: if request.auth != null &&
request.auth.uid in resource.data.participants;
allow create: if request.auth != null;
}
// Allow messages for chat
match /messages/{messageId} {
allow read, write: if request.auth != null;
allow create: if request.auth != null && request.auth.uid == request.resource.data.senderId;
}
// Allow test collection for debugging (temporary)
match /test/{document} {
allow read, write: if request.auth != null;
}
}
}