I am currently working on my final year project using react and firebase,
I have been working with firebase and been able to store the data directly,
but now I want to give role-based access to the users.
This is the* hierarchy * of users to store all data which is received and topmost level user i.e principal can read and write all the data ( principal, vice principal, hod, faculties) branches, *lower level user i.e vice-principal should not be able to read and write the data(fields in particular) associated with principal but can read and write the data associated with(vice principal, hod, faculties)* branches. and so on.....
I would appreciate any help. Thanks in advance.
When you create a user in the system copy their uid into a user collection and assign the user a role when they are created. Then in the future query that user by their uid to see what role they have and give them access to the content/functionality in question, based on the query response.