-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfirestore.rules
More file actions
48 lines (47 loc) · 1.64 KB
/
firestore.rules
File metadata and controls
48 lines (47 loc) · 1.64 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
match /accounts/{account} {
allow read: if true
allow write: if request.auth.uid == resource.data.uid;
allow delete: if request.auth.uid == resource.data.uid;
allow create: if request.auth.uid == request.resource.data.uid;
}
match /account_characters/{account_character} {
allow read: if true
allow write: if request.auth.uid == resource.data.uid;
allow delete: if request.auth.uid == resource.data.uid;
allow create: if request.auth.uid == request.resource.data.uid;
}
match /tables/{table} {
allow read: if true
allow write: if request.auth.uid in resource.data.managers;
allow delete: if request.auth.uid in resource.data.managers;
allow create: if request.auth.uid in request.resource.data.managers;
}
match /chronicles/{chronicle} {
function checkPerms(data) {
return request.auth.uid == data.uid || (data.table && request.auth.uid in get(/tables/$(data.table)).data.managers)
}
allow read: if true
allow write: if checkPerms(resource.data)
allow delete: if checkPerms(resource.data)
allow create: if checkPerms(request.resource.data)
}
match /wiki/{document=**} {
allow read: if true
allow write: if true
allow create: if true
allow delete: if false
}
match /{path=**}/wiki_character/{characterId} {
allow read: if true
allow write: if true
allow create: if true
allow delete: if false
}
}
}