-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
34 lines (27 loc) · 932 Bytes
/
firestore.rules
File metadata and controls
34 lines (27 loc) · 932 Bytes
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Helper function to check for organizer role
function isOrganizer() {
return request.auth.token.isOrganizer == true;
}
// Organizers have full admin access to EVERYTHING
match /{document=**} {
allow read, write: if isOrganizer();
}
match /users/{userId} {
// Only the authenticated user can read or write their own data.
allow read, write: if request.auth.uid == userId;
}
match /teams/{teamId} {
// Team members can read the entire team document.
allow read: if request.auth.uid in resource.data.memberIds;
// Prevent members from creating or deleting teams (only organizers can do that via the global rule)
allow create, delete: if false;
}
match /event/{eventId} {
// Anyone can read event data.
allow read: if true;
}
}
}