Use RequestHelpers.GetSession in SessionWebSocketListener (#14494)

This commit is contained in:
Niels van Velzen 2025-07-21 04:00:47 +02:00 committed by GitHub
parent 6cee66119e
commit 48e93dcbce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 28 deletions

View file

@ -111,7 +111,16 @@ public static class RequestHelpers
return user.EnableUserPreferenceAccess;
}
internal static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext, Guid? userId = null)
/// <summary>
/// Get the session based on http request.
/// </summary>
/// <param name="sessionManager">The session manager.</param>
/// <param name="userManager">The user manager.</param>
/// <param name="httpContext">The http context.</param>
/// <param name="userId">The optional userid.</param>
/// <returns>The session.</returns>
/// <exception cref="ResourceNotFoundException">Session not found.</exception>
public static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext, Guid? userId = null)
{
userId ??= httpContext.User.GetUserId();
User? user = null;