firebase / friendlyeats-web

Apache License 2.0
493 stars 412 forks source link

Example firestore.rules and description are not matched #72

Open Kesin11 opened 5 years ago

Kesin11 commented 5 years ago

In "12 Secure your data", below description is not match to example firestore.rules.

Updates to a restaurant document can only change the ratings, not the name or any other immutable data.

firestore.rules restrict to update only name.

      allow update: if request.auth != null
                    && request.resource.data.name == resource.data.name

Either description or firestore.rules is incorrect. I think firestore.rules is incorrect. Probably this is correct rule.

      allow update: if request.auth != null
                    && request.resource.data.name == resource.data.name
                    && request.resource.data.city == resource.data.city
                    && request.resource.data.price == resource.data.price
                    && request.resource.data.category == resource.data.category
                    && request.resource.data.photo == resource.data.photo;