-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
21 lines (20 loc) · 803 Bytes
/
Copy pathdatabase.rules.json
File metadata and controls
21 lines (20 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"rules": {
"defects": {
".read": "auth != null",
".write": "auth != null",
"$defectId": {
".validate": "newData.hasChildren(['id', 'title', 'description', 'location', 'imageUrls', 'reportedBy', 'timestamp', 'status', 'priority']) &&
(!data.exists() || (data.child('status').val() != newData.child('status').val() ?
root.child('users').child(auth.uid).child('isAdmin').val() == true :
auth.uid == data.child('reportedBy').val()))"
}
},
"user-defects": {
"$userId": {
".read": "auth != null && (auth.uid == $userId || root.child('users').child(auth.uid).child('isAdmin').val() == true)",
".write": "auth != null && auth.uid == $userId"
}
}
}
}