Getting user roles with JavaScript
Hi,
I am doing some JavaScript development for a page, and I need to do conditional logic based on the group the current user belongs to. How would I get all of the user roles through JavaScript?
Thanks.
You could...
1) Create a service to return the roles, run your code in the callback of it
2) You could create a widget for your masterpage, mvc layout, or just the page that this code needs to run, would render out the roles wherever you want and then your script has access to that.
?
[quote]Steve said:
1) Create a service to return the roles, run your code in the callback of it
[/quote]
This would work, but where do I supply my current user information?
[quote]Steve said:
2) You could create a widget for your masterpage, mvc layout, or just the page that this code needs to run, would render out the roles wherever you want and then your script has access to that.
[/quote]
Is this using the Sitefinity web designer or Visual Studio? I'm not able to get Sitefinity Thunder working in my environment.
Went with a third option. Made a cookie that stored the relevant information of my user's roles, and I'm pulling from that.