Re: DNN Provider 4.0 - Customize Toolbar by Role?

  •  02-10-2005, 8:23 PM

    Re: DNN Provider 4.0 - Customize Toolbar by Role?

    I checked the DNN code again. I think the following code will resolve the problem.
     

     

    Title

    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 _roleinfo As RoleInfo = New RoleInfo

        Dim str As String() = _roleController.GetRolesByUser(objUser.UserID, _portalSettings.PortalId)

        Dim isInRole As Boolean = False

        Dim strInfo As String

        For Each strInfo In str

            _roleinfo = _roleController.GetRole(Int32.Parse(strInfo))

            If (_roleinfo.RoleName = roleName) Then

                isInRole = True

               Exit For

            End If

        Next

        Return isInRole

    End Function


    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