Admin User Role

In my user signup page I have a checkbox for admin users, if checked it will create a record in the database against that user for adminuser: true, if unchecked the record will be adminuser: false

On login I want to a click a button for admin users to visit the admin portal, but the button needs to check the database for the true/false. Any ideas on how this could be achieved?

In the document, you can have the user id and the admin parameter, then when the user signs in, you filter to get the document with the user id equal the current user and check what’s the value og the admin parameter.

What would be the best way to achieve this?

If you have time, we can have a call and i can show you how to make that.
my hourly rates, are 30$ for lessons and 20 for development.

sorry for that option, but im so busy these days, to give you a better explanation,
in firebase have something like this
image
then when a user signs in, you will filter the collection by user id and in the response, you can see the position of that user. then, you can set rules in appgyver, or play with visibility, based on the position.

That’s one way to do it, there are other ways, where you can also be based on the firebase rules and work based of that (that’s maybe more secure, but is also more difficult, you need to know from firebase rules)

One last way i have, is to use this information, and have the user position stored in that


https://firebase.google.com/docs/reference/rest/auth#section-update-profile
This last option, is the least safe, because the user is able to change his profile data and so he could change the position, on the on other hand, when you use the first way, you can set rules in firebase, so that the user is not able to change that data.

Hope that helps

I will give this a try and come back if there’s any issues! Thank you for explaining!

1 Like

is there not a way to have adminuser: “true”/“false” in the firebase database against the user and filter that?

Screenshot 2022-06-22 at 10.24.03

Any idea on a formula that could filter that?