-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathfirestore.rules
More file actions
50 lines (49 loc) · 1.96 KB
/
firestore.rules
File metadata and controls
50 lines (49 loc) · 1.96 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
49
50
service cloud.firestore {
match /databases/{database}/documents {
function getSector(sectorId) {
return get(/databases/$(database)/documents/entities/sector/entity/$(sectorId));
}
match /entities/{entityType}/entity/{entityId} {
allow create: if false;
allow update, delete: if resource.data.creator == request.auth.uid &&
entityType in ["asteroidBase", "asteroidBelt", "blackHole", "deepSpaceStation",
"gasGiantMine", "moon", "moonBase", "note", "orbitalRuin", "planet",
"refuelingStation", "researchBase", "sector", "spaceStation", "system"];
allow read;
}
match /users/{uid} {
allow read, write: if request.auth != null && uid == request.auth.uid;
}
match /navigation/{sectorId}/routes/{routeId} {
allow write: if request.auth != null
&& getSector(sectorId).data.creator == request.auth.uid;
allow read;
}
match /layers/{sectorId}/layer/{layerId=**} {
allow create: if request.auth != null
&& getSector(sectorId).data.creator == request.auth.uid
&& ('regions' in request.resource.data || request.resource.data.name.size() <= 40);
allow update, delete: if request.auth != null
&& getSector(sectorId).data.creator == request.auth.uid;
allow read;
}
match /factions/{sectorId}/faction/{factionId=**} {
allow create: if request.auth != null
&& getSector(sectorId).data.creator == request.auth.uid
&& request.resource.data.name.size() <= 40;
allow update, delete: if request.auth != null
&& getSector(sectorId).data.creator == request.auth.uid;
allow read;
}
match /tags/{tagId} {
allow create: if request.auth != null
&& request.resource.data.creator == request.auth.uid;
allow update, delete: if request.auth != null
&& resource.data.creator == request.auth.uid;
allow read;
}
match /{document=**} {
allow read, write: if false;
}
}
}