Can I give users admin privileges with just saving them to the database like so:
export const newUser = (uid) => {
firebase
.database()
.ref("users/" + uid)
.set(
{
admin: false,
isProfileFilled: false,
phone: "",
credit: 0,
injuries: "",
},
function (error) {
if (error) {
console.log("error saving to db");
} else {
console.log("saved successfully");
}
}
);
};
My end goal is to be able to grant users admin access manually from the firebase console. Then when the user logs In check if he is an admin, if true show then all pieces of UI, if false the user should be verified by the admin until then show them a waiting page, When verified the normal user show see specific pieces of UI. Also, the admin should be able to modify users (delete them or change their credit value for example)
Can I achieve all of the above without using Firebase Admin SDK, just simply setting and updating the users in the database? What are the best practices to achieve my goal?