Current user info for an Experience app.
FeaturedFor an experience app, we want to know what user groups the current user belongs to.
My thought was that window.ShowpadLib.getUserInfo() might provide that info.
But I seams that this method returns the error “Showpad user not available” when I type this command in the chrome dev console.
Is this because I try to quickly test this from the console (instead of using it properly from the js code in the app)?
Or should I get proper info as shown in the example at https://showpad.pages.showpad.io/showpad-js-lib/reference-v7.html#getuserinfo?
Of course I was hoping to find the user groups in there… So any other solution to know the user groups of the current user would be useful.
We prefer to use the JS API because we want this info available when working offline on an iPad. But if this is not possible, we might fall back to the rest API. I guess that this should work using /users/{id}/usergroups.json.
-
Official comment
Following up on your question:
Requesting the usergroups is not possible via the ShowpadJS.getUserInfo() method. It is - apart from using the REST API - not possible to get a list of the user groups for a user.
These user groups are also not used for any content in our apps. It only matters to provide a list of experiences and assets from the Showpad backend to our apps.
A second point to highlight: filtering content based on the user group in the frontend might imply a security risk. (As the filtering is done based on Javascript.)
Therefore, we believe it's better to use Dynamic Content Filtering as this will make sure that the content is filtered in the Showpad backed, without any influence of the frontend.
Thanks for the great question!
-
Hi Gert,
Thanks for reaching out and posting a great question.
In these situations, it's always good to understand what the end goal is.I created a support case to help you out with this. It gives us the chance to ask for more specific and direct information. If we find a general approach to do this for specific use cases, we'll share it here, in our community.
Thanks again!
-Cedric
0 -
Sure, thanks for the prompt action and looking forward to go through it on our call this afternoon!
0
Please sign in to leave a comment.
Comments
3 comments