Background
The RoleController class is the primary way for working with roles programatically with the DotNetNuke framework. The API documentation for this (and the rest of the public API) is available with the API documentation at
API documentation.
Accessing the current users roles
There are a number of ways to work with the current users roles. We can use the
UserController class and access the current user like so:
Dim userInfo = UserController.GetCurrentUserInfo()
Dim userRoles = userInfo.Roles
alternatively we can use the rolecontroller methods, though we will have to provide additional information. In the example below the code is on a control that inherits from PortalModuleBase so we have access to the PortalID
Dim userRoles As New DotNetNuke.Security.Roles.RoleController
Dim userInfo As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo
Dim showroles As String = ""
For Each i As String In userRoles.GetRolesByUser(userInfo.UserID, me.PortalID)
showroles += i.ToString() & ","
Next
Additional references:
Create a New User and Add to Specific Role Programatically