-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold-firestore-security-rules
80 lines (65 loc) · 2.8 KB
/
old-firestore-security-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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// This rule allows anyone with your database reference to view, edit,
// and delete all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// all client requests to your Firestore database will be denied until you Update
// your rules
// match /{document=**} {
// allow read, write;
// }
match /Users/{userId} {
allow create,read: if request.auth != null;
allow update: if request.auth.uid == userId || request.auth.token.admin == true;
allow delete: if request.auth.token.admin == true && resource.data.role != 'Admin';
}
match /newUsers/{newuserId} {
allow create,write: if request.auth != null;
}
match /Teams/{teamId} {
allow create,read: if request.auth != null;
allow update: if request.auth.uid in resource.data.members || request.auth.token.admin == true;
allow delete: if request.auth.uid == resource.data.createdBy.id || request.auth.token.admin == true;
}
match /Projects/{projectId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Documents/{documentId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Documents/{documentId}/Attachments/{attachmentId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Requests/{requestId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Messages/{messageId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Messages/{messageId}/AllMessages/{allmessagesId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Chats/{chatId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /Chats/{chatId}/Messages/{messageId} {
allow read,create,update: if request.auth != null;
allow delete: if request.auth.token.admin == true;
}
match /DeletedUsers/{deleteduserId} {
allow read,write: if request.auth.token.admin == true;
}
}
}