How To Create Two User Groups In Firebase Web
I am developing a web app which uses Firebase Authentication and Real-time Database. The sign-in method is via Google and then if the user is new he/she will be ask if whether he/s
Solution 1:
[UPDATED]
You could try this the simple way:
Create a JSON object to store the users information in a field depends on the usage:
- a field
isTeacher
of type boolean (assume you won't add other user type) or - a field
userType
of object contain all the feature types (isTeacher: boolean, isStudent: boolean, isHeadmaster:boolean, etc.) or - a field of
userType
of type string
- a field
Create a method or condition to check the field of the user document whether is
true
for a particular user type /compare string
(depends which one you use) by usingif
orswitch
caseUnder each case / condition, show the elements of the web according to their privilege.
After signed-in, before the page load, do the checking using the function created
Post a Comment for "How To Create Two User Groups In Firebase Web"