-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfirestore-production.rules
49 lines (40 loc) · 1.41 KB
/
firestore-production.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isPublicDeal() {
return !resource.data.registrationData.isPrivate;
}
function userIsProposalLead() {
return request.auth.uid == resource.data.registrationData.proposalLead.address;
}
function userIsRepresentative() {
return request.auth.uid in resource.data.representativesAddresses;
}
function userIsAuthenticated() {
return request.auth != null;
}
function updateOnlyToDiscussions() {
return request.resource.data.diff(resource.data).affectedKeys().hasOnly(['clauseDiscussions']);
}
match /deals-token-swap/{deal} {
allow read: if isPublicDeal() || userIsProposalLead() || userIsRepresentative();
allow update: if userIsProposalLead() || updateOnlyToDiscussions();
allow create, delete: if false;
}
match /deals-token-swap/{deal}/primary-dao-votes/{representative} {
allow read, create, delete: if false;
allow update: if request.auth.uid == resource.id;
}
match /deals-token-swap/{deal}/partner-dao-votes/{representative} {
allow read, create, delete: if false;
allow update: if request.auth.uid == resource.id;
}
match /deals-token-swap-updates/{document} {
allow read: if true;
allow write: if false;
}
match /{document=**} {
allow read, write: if false;
}
}
}