-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
21 lines (19 loc) · 862 Bytes
/
firestore.rules
File metadata and controls
21 lines (19 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Default read allowed if signed in
match /actions/{document=**} {
allow read: if request.auth != null;
}
// https://firebase.google.com/docs/firestore/solutions/role-based-access
match /quizzes/{document=**} {
allow read: if request.auth.uid == resource.data.owner || resource.data.shared;
// If you create a quiz, you must set yourself as the owner.
allow create: if request.auth.uid == request.resource.data.owner;
// Only the owner may delete a quiz
allow delete: if request.auth.uid == resource.data.owner;
// The owner may update anything about the quiz except the owner.
allow update: if request.auth.uid == resource.data.owner && request.resource.data.owner == resource.data.owner;
}
}
}