-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathfirestore.rules
More file actions
25 lines (20 loc) · 712 Bytes
/
firestore.rules
File metadata and controls
25 lines (20 loc) · 712 Bytes
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function userExists() {
return exists(/databases/$(database)/documents/users/$(request.auth.uid));
}
match /users/{userId} {
allow read, update, delete: if request.auth.uid == userId;
allow create: if request.auth.uid != null;
}
match /items/{itemId} {
allow create: if userExists();
allow read, update, delete: if resource.data.createdBy == request.auth.uid;
}
match /user_subscriptions/{userSubscriptionId} {
allow create: if userExists();
allow read, update, delete: if 'user-' + request.auth.uid == userSubscriptionId;
}
}
}