In the designer, I tried to use the Display-Show in dynamic attributes for the links that I want to be shown only for the “admin” role, but the “role” field doesn’t show up in the user details server connect list:
Now, if the scAdmin data source contains data, the user is an Admin. As you can see, I have two paragraphs. The ’user paragraph is hidden when the user is an Admin. The other is shown when the user is an Admin.
@ben Thank you very much for the explanation of your workaround. I think this would be really useful. Not only to show and hide buttons and links but also to show and hide other elements. How can we propose this to become a new useful feature?
Here is a thought. In your onboarding create account flow, once a new user is created. You can add a condition that insert or update a separate field in your user database table that ties each role to a value let say this field is called tracker and has enum (1,2,3) where admin get 1, users get 2 & super users get 3, etc. Now in your registration flow you should have set your user table role and tracker fields defaults in the database by the enum default, so every on create each new users defaults to role = user and in your tracker field have it default to 2. This is given that you use enum for these fields currently else do it in your registration code flow when inserting new user set the defaults for those field values role and tracker. Now once you are ready to give users their role you can update the default roles along with their tracker value and when you want to hide something on a page query the user table tracker field values instead of the role field values and set the condition where role = tracker this will filter and bring back all role of users. Now when you want to hide/show elements browser side or from server side the tracker values already filter the query and you can user it however. Doing it this way will help on the browsers side not make the users role field available to be so obvious in the query when validating access level or hide/show or validating email verification link.
In other world you can help us by adding your vote to my request feature for auth0 this way we don’t have to build out our own login system and worry about zero day vulnerability and maintenance for your clients. Building your own login system is cool and all using Wappler but I would advise against doing so if one is really serious about going big time as a web developer because the risk of doing it in a closet is real especially when doing big clients project that already has auth0 integrate in their application.