Getting user roles with JavaScript

Posted by Community Admin on 04-Aug-2018 18:36

Getting user roles with JavaScript

All Replies

Posted by Community Admin on 09-Dec-2015 00:00

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.

Posted by Community Admin on 09-Dec-2015 00:00

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.

 

?

Posted by Community Admin on 09-Dec-2015 00:00

[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.

Posted by Community Admin on 14-Dec-2015 00:00

Went with a third option. Made a cookie that stored the relevant information of my user's roles, and I'm pulling from that.

This thread is closed