I'd like to have a read-only property called suspendedProfile
in a user
document with all the other properties with read/write access for currently logged in user. Is there a way to do it with a simple security rule?
I thought about 2 solutions:
- disallow writes that modify the property like
allow write: if request.resource.data.suspendedProfile == null;
- a
/secure
collection withallow read;
inside theuser
document
I think the first option is better all the user-related properties are in a single docment, but I'd love to hear your thoughts. Is there any other simpler way to achieve this?
I think I managed to find a solution for my own answer using Firebase documentation.
So in my case, I will just
allow update: if request.resource.data.suspendedProfile == resource.data.suspendedProfile