cancel
Showing results for 
Search instead for 
Did you mean: 

Show/Hide parts user roles Appgyver and Firebase

rb1903
Discoverer
0 Kudos

I've building my own app for a few weeks now and it works all fine. Till I had the idea to create roles en want to hide certain buttons when a specific role logged in. I've tried everything but I'm very stuck at the moment.

I connect Firebase with Appgyver and they are communication with eachother. The user's name is showing when he/she is logged in. The data can be collected from the backend but it will not be recognized when I try to hide the lower buttons for the ''normal'' users.

In Firebase I made 2 types of roles:
1. Users
2. Admin

When a Admin user is logged in I want them to see all the buttons. Normal Users kan only see the top thee buttons. So I want to hide them. I placed the lower 3 in a separate container so it would be easier to hide them. This is my flow on the homepage. Data is stored and can be used on the pages.

I read somewhere you can change the visibility with the IF condition. So that's what I would like to use.

This is the formula I found:

After entering the formula, I logged in as a Admin user and the homepage was loaded the lower buttons were nog showing. I think the pageVar.Role and ''Admin'' role didn't match? What am I doing wrong? Are there some tips or solutions to solve this problem. I read a lot about this topic and it can be very difficult. I'm not a great coding specialist so a simple instruction or tip would help me 🙂

Accepted Solutions (1)

Accepted Solutions (1)

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

First, you do not have to use the IF for a field that is true/false. Just a formula that results in true or false.

Isn't the role a string, so shouldn't you compare it to "Admin"?

Entire formula:

IS_EQUAL(pageVars.Role, "Admin")  
rb1903
Discoverer

Wow! That was exactly what I ws looking for. You are my hero! Thanks for your help 🙂

Answers (0)