Gabe O'Leary
1 min readApr 30, 2020

--

I found the last section super helpful.

I wanted to store a users (paid) subscription status in their user doc but not allow them to change it.

In order to disallow updating of a single field in their own document this is what I settled on:

 match /users/{userId}/{document=**} {
allow read, delete: if request.auth.uid == userId;
allow update: if request.auth.uid == userId &&
request.resource.data.subscription == resource.data.subscription;
allow create: if request.auth.uid != null;
}`

--

--

Gabe O'Leary
Gabe O'Leary

Written by Gabe O'Leary

If all you ever do is all you've ever done, then all you'll ever get is all you ever got.

No responses yet