Hi I have a list of users in my fb database. The user id is auto-generated after successful registration and each user entry has the name, email, and uid. Also, each of these properties is being indexed in /index so that I can easily look up a user's id given their uid.
According to the docs, firebase says to use write: $user_id === auth.uid
How can I accomplish this using the generated ID instead of the uid?
here's the fb db: https://medviz.firebaseio.com/
In Your users object there will be users like this
you will have many
unique key/user nodes
in users object, eguser1234abc
,user2434dbcc
That unique key can be named any
variable
in rules it not necessary to call it$user_id
, you can call it anything you want for example you can name the variable as$any_variable
for unique user keysand in auth.id whenever user successfully authenticate that same unique id is in
auth.uid
so you can any where math thatauth.uid
when you are editing the info related to that userFor example if
auth.uid
containsuser1234abc
and ifuser1234abc
is editing this objectuser1234abc:{name: "abc" }
thn accordind to .write rule he will be able toSee the updated view below
Updated Visual Hierarchy: