-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
33 lines (33 loc) · 1.34 KB
/
firestore.rules
File metadata and controls
33 lines (33 loc) · 1.34 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /games/{gameId} {
allow get;
allow list:if request.query.limit <= 25
&& request.auth.uid in resource.data.uids;
match /moves/{userId} {
allow create: if request.auth.uid == userId;
}
}
match /users/{userId} {
allow get: if request.auth.uid == userId;
allow create, update: if request.auth.uid == userId
&& request.resource.data.keys().hasOnly(['nickname', 'color'])
&& request.resource.data.nickname is string
&& request.resource.data.nickname.size() <= 15
&& (!('color' in request.resource) || request.resource.data.color in ['red', 'blue', 'green', 'orange', 'purple', 'yellow']);
match /private/tokens {
allow get: if request.auth.uid == userId;
allow create, update: if request.auth.uid == userId && request.resource.data.values().hasOnly([true]);
}
}
match /queues/{queueName} {
allow get;
allow update:
if request.resource.data[request.auth.uid] == true
&& request.resource.data.diff(resource.data).addedKeys() == [request.auth.uid].toSet()
&& request.resource.data.diff(resource.data).changedKeys() == [].toSet()
&& request.resource.data.diff(resource.data).removedKeys() == [].toSet()
}
}
}