更新时间:2023-12-05 20:04:58
如果您将文档保存用户的uid存储在文档中(例如),例如 createdBy
请执行以下操作:
If you store in the document the uid of the user who saved the doc in a field called (for example) createdBy
you can do as follows:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if request.auth.uid != null && resource.data.createdBy == request.auth.uid;
allow write: ....
}
}
}