Untitled
unknown
jsx
4 years ago
1.0 kB
6
Indexable
rules_version = '2';
service cloud.firestore {
function emailVerified() {
return request.auth.token.email_verified;
}
function IsOwnerOfUser(userId){
return emailVerified() && request.auth.uid == userId;
}
function IsMessageOwner(){
return emailVerified() && resource.data.sender_auth.uid == request.auth.uid;
}
function IsRoomOwner(){
return emailVerified() && resource.data.owner == request.auth.uid;
}
match /databases/{database}/documents {
match /{anySub=**}{
allow read, get, list: if emailVerified();
}
match /rooms/{roomId} {
allow create: if emailVerified();
allow delete, update: if IsRoomOwner();
}
match /rooms/{roomId}/messages/{messageId}{
allow create: if emailVerified();
allow delete, update: if IsMessageOwner();
}
match /users/{userId} {
allow read: if emailVerified();
allow write: if IsOwnerOfUser(userId);
}
}
}Editor is loading...