-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathfirestore.rules
27 lines (25 loc) · 1.06 KB
/
firestore.rules
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 {
match /hits/{shorturl}{
allow read: if request.auth.uid == resource.data.author;
allow delete: if get(/databases/$(database)/documents/shorturls/$(shorturl)).data.author == request.auth.uid;
allow update: if request.resource.data.hits == 1 + resource.data.hits;
allow update: if request.resource.data.author == resource.data.author && request.resource.data.curl == resource.data.curl;
allow create: if request.resource.data.hits == 1 &&
!exists(/databases/$(database)/documents/hits/$(shorturl));
}
match /shorturls/{shorturl}{
allow read : if true;
allow create : if request.auth.uid != null;
allow update,delete: if request.auth.uid == resource.data.author;
match /tracking/{trackingId}{
allow read, delete, update : if request.auth.uid == resource.data.author;
allow create : if true;
}
}
match /settings/{uid}{
allow read,write: if request.auth.uid == uid;
}
}
}