Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Find out current user role View modes: 
User avatar
Member
Member
mukesh.laxkar-octalsoftware - 1/16/2012 4:37:01 AM
   
Find out current user role
Hi,

I need to find role of current user. i was trying CMSContext.CurrentUser. but there is no such way to find out.
if there any way to find role of current user in kentico cms please reply soon

thanks.

User avatar
Kentico Support
Kentico Support
kentico_janh - 1/16/2012 5:50:19 AM
   
RE:Find out current user role
Hello,

A user can belong to more roles than one, so there is a function for it in our API:

public static DataSet GetUserRoles(
string where,
string orderBy,
int topN,
GeneralConnection conn
)


And you can compare current user's ID in the where condition:

UserRoleInfoProvider.GetUserRoles("UserID = " + CMSContext.CurrentUser.UserID, "", 0, cn);


Best regards,
Jan Hermann