We would need a role column in our User table.
role can be an Enum with the following options: "STUDENT", "TEACHER", "ADMIN"
By default, let's set the 3 of us to "ADMIN"/"SUPERADMIN" and then every other user who signs up gets "GUEST"/"STUDENT" role by default.
Now when I call the function isAdminUser(), the function checks the database for the currently logged in user's role, and returns true / false if he's "ADMIN".
We would need a
rolecolumn in ourUsertable.rolecan be an Enum with the following options:"STUDENT","TEACHER","ADMIN"By default, let's set the 3 of us to
"ADMIN"/"SUPERADMIN"and then every other user who signs up gets"GUEST"/"STUDENT"role by default.Now when I call the function
isAdminUser(), the function checks the database for the currently logged in user'srole, and returns true / false if he's"ADMIN".