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.....
to be more clear

I would appreciate any help. Thanks in advance.