In Firebase Database; If user_a
has data they can access and they want to share this data with user_b
, what is the best practice and database structure for securely sharing this data between specific users?
Important: user_a
doesn't have any information about user_b
account, e.g. uid
.
Detailed Example:
1) user_a
has a list of clientele.
"users": {
"user_a": {
"clients": [
"clientUid",
"clientUid2"
]
}
},
"clients": {
"clientUid": {
"firstName": "John",
"lastName": "Doe"
},
"clientUid2": {
"firstName": "Joe",
"lastName": "Bloggs"
}
}
2) user_b
signs up. user_a
now wants to share user_b
data in clients
with the user_b
account that signed up.
Put another way: user_a
has a list of clients, one of them creates an account and needs to link to the information user_a
has already entered for them.
An important element here is that there is no list of users or accounts that a 'friend request' can be made from for more data. I have experimented with creating a short unique id a user can enter when they sign up to access their data, but am unsure if this is a good way forward and have encountered issues.
This is different to previously asked 'shared data' questions as it focuses on, how is the link between the two users made? Not just the before and after.