Forum Discussion
Hello ClaudiusH -
Thanks for jumping in to help. I'll do my best to explain - my Lithium-specific terminology is admittedly not the best.
We have a component which currently uses Lithium-assigned roles in an if/then/else statement to display other components.
A basic view is the following:
<#if user_is_in_role > <@component id="Component1a" /> <#else> <@component id="Component1b" /> </#if>
This has been working well, except that we're using the Lithium role definitions to assign a value to the 'user_is_in_role' variable. We're now working to replace the role-based variable assignment with an external data source making RESTful API calls with http.client. This is where we run into challenges.
We can successfully make the requests and compile the JSON results in an endpoint. However, where we're getting stuck is assigning the variables so that they can be referenced within if/then/else statements in the primary component. It sounds very similar to the second post you shared, but in reverse order where assigning the variable in the endpoint is returning a null response from the component.
How often do these roles change? How quick do they need to update? You would want to avoid checking via a REST call against your source every time this page is loading. Maybe it's sufficient to perform this check every time a user signs in to your community?
Related Content
- 4 years agoInactive User
- 6 months ago