react-admin-firebase
react-admin-firebase copied to clipboard
Set resource collection based on user
Hi,
I'd like to be able to set my resource collection based on the logged in user (e.g. users/Jane), but can't seem to figure out a way to do this easily. I see you can set the rootref
in the options, but this would only be static. I need to set this dynamically based on who is logging in..
Seems like this would be a common use case where someone has different documents for each user. Am I missing something?
Thanks!
In other words, do you want to create and control the firestore collection of users accessed via Authentication?
In other words, do you want to create and control the firestore collection of users accessed via Authentication?
Yes, and access only the resources that are owned by the logged in user.
Hey @7200rpm, I agree that this would be a very useful feature. I think this issue is a more general version of our problem: https://github.com/benwinding/react-admin-firebase/issues/7. Essentially, accessing a resource sub-collection under the user (e.g. users/Jane/some-sub-collection) is not possible under react-admin-firebase yet.
@7200rpm. There is no user collection base on Firebase Authentication.In my case, when a user is created through Firebase Authentication, the function is triggered to create a new document in the users collection of firestore with the corresponding email. this may help you https://bigcodenerd.org/create-user-profile-firestore-authentication/