forked from scottbenton/Iron-Fellowship_and_Crew-Link
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirestore.rules
70 lines (65 loc) · 2.19 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /characters/{userId} {
allow read: if true;
allow write, delete: if userId == request.auth.uid;
match /{document=**} {
allow read: if true;
allow update: if request.resource.data.diff(resource.data).affectedKeys().hasOnly(["campaignId", "initiativeStatus"])
allow write, delete: if userId == request.auth.uid
}
}
match /campaigns/{document=**} {
allow read, write, delete: if true;
}
match /worlds/{worldId} {
allow read: if true;
allow write: if request.auth.uid == resource.data.ownerId;
function checkIsOwner() {
let world = get(/databases/$(database)/documents/worlds/$(worldId)).data;
return world.ownerId == request.auth.uid;
}
match /locations/{locationId} {
allow read, create, update: if true;
allow delete: if checkIsOwner();
match /private/{gmNotes} {
allow read, write: if checkIsOwner();
}
match /public/{notes} {
allow read, create, update: if true;
allow delete: if checkIsOwner();
}
}
match /npcs/{locationId} {
allow read, create, update: if true;
allow delete: if checkIsOwner();
match /private/{gmNotes} {
allow read, write: if checkIsOwner();
}
match /public/{notes} {
allow read, create, update: if true;
allow delete: if checkIsOwner();
}
}
}
match /users/{userId} {
allow read: if true;
allow write: if userId == request.auth.uid && !request.resource.data.diff(resource.data).affectedKeys().hasAny(["isPremium"]);
match /custom-oracles/{document=**} {
allow read: if true;
allow write, delete: if userId == request.auth.uid;
}
match /custom-moves/{document=**} {
allow read: if true;
allow write, delete: if userId == request.auth.uid;
}
match /settings/{document=**} {
allow read, write, delete: if userId == request.auth.uid;
}
}
match /{document=**} {
allow read, write: if false;
}
}
}