Allow explicitly set userId for RequestHelpers.GetSession (#11505)
This commit is contained in:
parent
4044431610
commit
8c583bbe37
|
@ -90,7 +90,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|||
return NotFound();
|
||||
}
|
||||
|
||||
var session = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false);
|
||||
var session = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext, userId).ConfigureAwait(false);
|
||||
|
||||
var dto = UpdatePlayedStatus(user, item, true, datePlayed);
|
||||
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||
|
@ -155,7 +155,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|||
return NotFound();
|
||||
}
|
||||
|
||||
var session = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false);
|
||||
var session = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext, userId).ConfigureAwait(false);
|
||||
|
||||
var dto = UpdatePlayedStatus(user, item, false, null);
|
||||
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||
|
|
|
@ -117,10 +117,10 @@ public static class RequestHelpers
|
|||
return user.EnableUserPreferenceAccess;
|
||||
}
|
||||
|
||||
internal static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext)
|
||||
internal static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext, Guid? userId = null)
|
||||
{
|
||||
var userId = httpContext.User.GetUserId();
|
||||
var user = userManager.GetUserById(userId);
|
||||
userId ??= httpContext.User.GetUserId();
|
||||
var user = userManager.GetUserById(userId.Value);
|
||||
var session = await sessionManager.LogSessionActivity(
|
||||
httpContext.User.GetClient(),
|
||||
httpContext.User.GetVersion(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user