Thanks for replying so quckly !
I got the idea here and I think we want to be specifying an AutoConfigure option rather than a Security config file, in order to configure the toolbars, right?
I modified your code a little, however I have a problem - I am always getting the same configuration, no matter which of my three groups I put my test user in. How come the code isn't detecting the group?
Here's my code:
Public Sub New()
.........
If IsCurrentUserInRole("Full HTML Editor") = True Then
cntlCE.AutoConfigure = AutoConfigure.Full
ElseIf IsCurrentUserInRole("Default HTML Editor") = True Then
cntlCE.AutoConfigure = AutoConfigure.Simple
ElseIf IsCurrentUserInRole("Minimal HTML Editor") = True Then
cntlCE.AutoConfigure = AutoConfigure.Minimal
Else
cntlCE.AutoConfigure = AutoConfigure.Simple
End If
Me.HtmlEditorControl = cntlCE
End Sub
'Detect the DNN Role the current user is in
Public Shared Function IsCurrentUserInRole(ByRef roleName As String) As Boolean
If (roleName = "" Or System.Web.HttpContext.Current.User.Identity.Name = "") Then
Return False
End If
Dim _portalSettings As PortalSettings = CType(System.Web.HttpContext.Current.Items("PortalSettings"), PortalSettings)
Dim objUsers As UserController = New UserController
Dim objUser As UserInfo = objUsers.GetUser(_portalSettings.PortalId, Int32.Parse(HttpContext.Current.User.Identity.Name))
Dim _roleController As RoleController = New RoleController
Dim str As String() = _roleController.GetRolesByUser(objUser.UserID, _portalSettings.PortalId)
Dim isInRole As Boolean = False
Dim strInfo As String
For Each strInfo In str
If (strInfo = roleName) Then
isInRole = True
End If
Next
Return isInRole
End Function