Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Macros + Roles View modes: 
User avatar
Member
Member
fan4u - 7/29/2011 4:57:39 PM
   
Macros + Roles
HI ,

can we get the current logged in user Roles through Macros.
How can i get them if user has multiple roles.

Thanks
Fan

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/30/2011 8:17:35 AM
   
RE:Macros + Roles
Hi,

you could create a custom macro for this with the following code inside.

UserInfo ui = UserInfoProvider.GetUserInfo(CMSContext.CurrentUser.UserID);
DataTable dt =CMS.SiteProvider.UserInfoProvider.GetUserRoles(ui);

This way you are able to select roles in which the current user is inserted and manage the format in which they should be returned by macro.

Best regards,
Ivana Tomanickova