Re: DNN Provider 4.0 - Customize Toolbar by Role?

  •  02-10-2005, 10:55 AM

    Re: DNN Provider 4.0 - Customize Toolbar by Role?

     
    Yes, you can have different set of tool buttons appear fro different DNN role.  You have to modify the code of the provider.
     
    Please follow the steps:
     
    1. Create s function IsCurrentUserInRole in the CEHtmlEditorProvider.vb
     
    IsCurrentUserInRole 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(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 (rInfo.RoleName() = roleName) Then
                        isInRole = True
                    End If
                Next
                Return isInRole
            End Function
     
    2. In the Public Sub New() .. End Sub, add the following code:
     
    Title
    cntlCE.SecurityPolicyFile = "Guest.config"

    If IsCurrentUserInRole("Administrators") = True Then
        cntlCE.SecurityPolicyFile = "Admin.config"
    ElseIf IsCurrentUserInRole("Site Editor") = True Then
        cntlCE.SecurityPolicyFile = "default.config"
    ElseIf IsCurrentUserInRole("Registered Users") = True Then
        cntlCE.SecurityPolicyFile = "Default.config"
    End If

    Hope it helps. Keep me posted.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread