Examples for Firebase configurations.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /guestbook/{entry} {
allow read: if
request.auth.uid != null;
allow create: if
request.auth.uid == request.resource.data.userId
&& "name" in request.resource.data
&& "text" in request.resource.data
&& "timestamp" in request.resource.data;
allow update: if
request.auth.uid == resource.data.userId
&& "name" in request.resource.data
&& "text" in request.resource.data;
allow delete: if
request.auth.uid == resource.data.userId;
}
match /attendees/{userId} {
allow read: if true;
allow create, update: if
request.auth.uid == userId
&& "attending" in request.resource.data;
allow delete: if
request.auth.uid == userId;
}
}
}
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /carts/{cartID} {
allow create: if
request.auth.uid == request.resource.data.ownerUID;
allow read, update, delete: if
request.auth.uid == resource.data.ownerUID;
}
match /carts/{cartID}/items/{itemID} {
allow read, write: if
get(/databases/$(database)/documents/carts/$(cartID)).data.ownerUID == request.auth.uid;
}
match /items/{itemID} {
allow read, create;
}
}
}