-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirestore.rules
More file actions
33 lines (31 loc) · 1.3 KB
/
Copy pathfirestore.rules
File metadata and controls
33 lines (31 loc) · 1.3 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow reading all users' data for leaderboard (including guests)
// But only show verified users in leaderboard
match /users/{userId} {
allow read: if true;
allow create: if request.auth != null && request.auth.uid == userId;
allow update: if request.auth != null && request.auth.uid == userId;
allow delete: if request.auth != null && request.auth.uid == userId;
}
// Allow authenticated users to read all stocks
// But only allow users to modify their own stocks
match /stocks/{stockId} {
allow read: if request.auth != null;
allow create, update: if request.auth != null &&
request.resource.data.userId == request.auth.uid;
allow delete: if request.auth != null &&
resource.data.userId == request.auth.uid;
}
// Allow authenticated users to read all transactions
// But only allow users to modify their own transactions
match /transactions/{transactionId} {
allow read: if request.auth != null;
allow create, update: if request.auth != null &&
request.resource.data.userId == request.auth.uid;
allow delete: if request.auth != null &&
resource.data.userId == request.auth.uid;
}
}
}