Вот два метода, на которые вы ссылаетесь из исходного кода текущей версии 5.4.2. Из того, что я вижу, различия
1) GetUser устарел
2) GetUser, кажется, вручную гидратирует роли, заметки предполагают, что отдельные пользователи автоматически гидратируются
вот старый метод
''' -----------------------------------------------------------------------------
''' <summary>
''' GetUser retrieves a User from the DataStore
''' </summary>
''' <remarks>
''' </remarks>
''' <param name="portalId">The Id of the Portal</param>
''' <param name="userId">The Id of the user being retrieved from the Data Store.</param>
''' <param name="isHydrated">A flag that determines whether the user is hydrated.</param>
''' <param name="hydrateRoles">A flag that instructs the method to automatically hydrate the roles</param>
''' <returns>The User as a UserInfo object</returns>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
<Obsolete("Deprecated in DNN 5.1. Not needed any longer for single users due to autohydration")> _
Public Shared Function GetUser(ByVal portalId As Integer, ByVal userId As Integer, ByVal isHydrated As Boolean, ByVal hydrateRoles As Boolean) As UserInfo
Dim user As UserInfo = GetUserById(portalId, userId)
If hydrateRoles Then
Dim controller As DotNetNuke.Security.Roles.RoleController = New DotNetNuke.Security.Roles.RoleController
user.Roles = controller.GetRolesByUser(userId, portalId)
End If
Return user
End Function
и вот новый метод
''' -----------------------------------------------------------------------------
''' <summary>
''' Get the current UserInfo object
''' </summary>
''' <returns>The current UserInfo if authenticated, oherwise an empty user</returns>
''' <history>
''' [cnurse] 05/23/2005 Documented
''' </history>
''' -----------------------------------------------------------------------------
Public Shared Function GetCurrentUserInfo() As UserInfo
If (HttpContext.Current Is Nothing) Then
If Not (Thread.CurrentPrincipal.Identity.IsAuthenticated) Then
Return New UserInfo
Else
Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
If Not _portalSettings Is Nothing Then
Dim objUser As UserInfo = GetCachedUser(_portalSettings.PortalId, Thread.CurrentPrincipal.Identity.Name)
If Not objUser Is Nothing Then
Return objUser
Else
Return New UserInfo
End If
Else
Return New UserInfo
End If
End If
Else
Dim objUser As UserInfo = CType(HttpContext.Current.Items("UserInfo"), UserInfo)
If Not objUser Is Nothing Then
Return objUser
Else
Return New UserInfo
End If
End If
End Function
это какая-то помощь?
спасибо
Марк Брин
Ирландия
1987 BMW R80GS