-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebase.rules
More file actions
24 lines (19 loc) · 1.05 KB
/
firebase.rules
File metadata and controls
24 lines (19 loc) · 1.05 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
service cloud.firestore {
match /databases/{database}/documents {
function userHasAddress(address) {
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.wallets.ETH.testnet.address.toLowerCase() == address || get(/databases/$(database)/documents/users/$(request.auth.uid)).data.wallets.ETH.mainnet.address.toLowerCase() == address;
}
// users
match /users/{user_id} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid == user_id || request.auth.uid == "chain";
allow delete: if request.auth.uid == user_id || request.auth.uid == "chain";
}
// transactions
match /transactions/{transaction_id} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid == request.resource.data.fromId || request.auth.uid == request.resource.data.toId || request.auth.uid == resource.data.fromId || request.auth.uid == resource.data.toId;
allow delete: if request.auth.uid == resource.data.fromId || request.auth.uid == resource.data.toId;
}
}
}