forked from Nodi3d/nodi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
27 lines (25 loc) · 892 Bytes
/
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
service cloud.firestore {
match /databases/{database}/documents {
match /user/{id} {
allow read, create: if request.auth != null;
allow write: if request.auth.uid == resource.data.uid;
}
match /graph/{id} {
function canView() {
return
resource.data.permission >= 100 ||
(request.auth.uid == resource.data.uid || request.auth.uid in resource.data.viewers || request.auth.uid in resource.data.writers || request.auth.uid in resource.data.admins)
;
}
function canEdit() {
return
resource.data.permission >= 101 ||
(request.auth.uid == resource.data.uid || request.auth.uid in resource.data.writers || request.auth.uid in resource.data.admins)
;
}
allow read: if canView();
allow create: if request.auth != null;
allow write: if canEdit();
}
}
}