-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
150 lines (147 loc) · 4.75 KB
/
firestore.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users
match /users/{userId} {
allow read: if true;
allow create: if true;
allow update: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
allow delete: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
}
// Accounts
match /accounts/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Acronyms
match /acronyms/{itemId} {
allow read: if true;
allow create: if hasRole('_admin') || hasRole('_assistant');
allow update: if hasRole('_admin') || hasRole('_assistant');
allow delete: if hasRole('_admin') || hasRole('_assistant');
}
// Applicants (jobs)
match /applicants/{itemId} {
allow read: if hasRole('_admin');
allow create: if true;
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Agencies
match /agencies/{itemId} {
allow read: if true;
allow create: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
allow update: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
allow delete: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
}
// Blogs
match /blogs/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Careers
match /careers/{itemId} {
allow read: if true;
allow create: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
allow update: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
allow delete: if hasRole('_admin') || hasRole('_assistant') || hasRole('_staffing');
}
// Clients
match /clients/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Contacts (Inbox)
match /contacts/{itemId} {
allow read: if hasRole('_admin');
allow create: if true;
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Contracts
match /contracts/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Contributions
match /contributions/{itemId} {
allow read: if hasRole('_admin');
allow create: if true;
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Faqs
match /faqs/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Glossaries
match /glossaries/{itemId} {
allow read: if true;
allow create: if hasRole('_admin') || hasRole('_assistant');
allow update: if hasRole('_admin') || hasRole('_assistant');
allow delete: if hasRole('_admin') || hasRole('_assistant');
}
// Leads (services / technologies contacts)
match /leads/{itemId} {
allow read: if hasRole('_admin');
allow create: if true;
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Legals
match /legals/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Partnerships
match /partnerships/{itemId} {
allow read: if hasRole('_admin');
allow create: if true;
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Services
match /services/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Tags
match /tags/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
// Technologies
match /technologies/{itemId} {
allow read: if true;
allow create: if hasRole('_admin');
allow update: if hasRole('_admin');
allow delete: if hasRole('_admin');
}
function isSignedIn() {
return request.auth != null;
}
function hasRole(role) {
return isSignedIn() && getRoles()[role] == true;
}
function getRoles() {
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data
}
}
}