-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.devfest.rules
36 lines (35 loc) · 1.07 KB
/
firestore.devfest.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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /companies-2023/{companyId} {
allow list, update: if isAdministrator() || notUpdating('name');
allow create, get: if true;
}
match /companies-2025/{companyId} {
allow list, update: if isAdministrator() || notUpdating('name');
allow create, get: if true;
}
match /workflows/{workflowId} {
allow list: if true;
allow get: if true;
}
match /configuration/{configurationId} {
allow get: if true;
allow update: if isAdministrator();
}
match /editions/{configurationId} {
allow get: if true;
allow update: if isAdministrator();
}
}
}
function notUpdating(field) {
return !(field in request.resource.data)
|| resource.data[field] == request.resource.data[field]
}
function isOwner(companyId) {
return request.auth.token.email in resource.data.email;
}
function isAdministrator() {
return request.auth.token.email.matches(".*@devlille.fr") || request.auth.token.email.matches(".*@gdglille.org")
}