When the user creates an account his information will be saved on my realtime database. Something like this:
{
username: "geroge",
plan: "free",
email: "georgeo@example.com",
}
And I don't want to let the user change this information. So this is my question how can I set up the rules so that the user is allowed to write the data to the database only once? Basically when he writes the data to the database the first, he can't change them anymore.
I've tried a couple of times to do this, but I didn't succeed this is are my rules:
{
"rules": {
".read": "true",
".write": "false",
"users": {
"$uid": {
".write": "$uid === auth.uid && !data.parent().exists()",
".read": "$uid === auth.uid"
}
}
}
}
I've tried to do something with write and check values exists, but it didn't work.