aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Helpers/RequestHelpers.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2024-08-28 12:39:48 -0600
committerGitHub <noreply@github.com>2024-08-28 12:39:48 -0600
commit8c3f3c503b4b0606e2987ed58e5228d72669afeb (patch)
treef139dd171ac4fcc5328061aa455644586c428b7a /Jellyfin.Api/Helpers/RequestHelpers.cs
parent639d75bd8300ee9538c5a8142cb86b7e89305d9a (diff)
parente221c1d25d640eaac01220b3f5b1422f4c11ed46 (diff)
Merge pull request #11665 from Bond-009/getuserbyid
Diffstat (limited to 'Jellyfin.Api/Helpers/RequestHelpers.cs')
-rw-r--r--Jellyfin.Api/Helpers/RequestHelpers.cs13
1 files changed, 3 insertions, 10 deletions
diff --git a/Jellyfin.Api/Helpers/RequestHelpers.cs b/Jellyfin.Api/Helpers/RequestHelpers.cs
index a3d7f471e..1d9c189a0 100644
--- a/Jellyfin.Api/Helpers/RequestHelpers.cs
+++ b/Jellyfin.Api/Helpers/RequestHelpers.cs
@@ -86,18 +86,17 @@ public static class RequestHelpers
/// <summary>
/// Checks if the user can update an entry.
/// </summary>
- /// <param name="userManager">An instance of the <see cref="IUserManager"/> interface.</param>
/// <param name="claimsPrincipal">The <see cref="ClaimsPrincipal"/> for the current request.</param>
- /// <param name="userId">The user id.</param>
+ /// <param name="user">The user id.</param>
/// <param name="restrictUserPreferences">Whether to restrict the user preferences.</param>
/// <returns>A <see cref="bool"/> whether the user can update the entry.</returns>
- internal static bool AssertCanUpdateUser(IUserManager userManager, ClaimsPrincipal claimsPrincipal, Guid userId, bool restrictUserPreferences)
+ internal static bool AssertCanUpdateUser(ClaimsPrincipal claimsPrincipal, User user, bool restrictUserPreferences)
{
var authenticatedUserId = claimsPrincipal.GetUserId();
var isAdministrator = claimsPrincipal.IsInRole(UserRoles.Administrator);
// If they're going to update the record of another user, they must be an administrator
- if (!userId.Equals(authenticatedUserId) && !isAdministrator)
+ if (!user.Id.Equals(authenticatedUserId) && !isAdministrator)
{
return false;
}
@@ -108,12 +107,6 @@ public static class RequestHelpers
return true;
}
- var user = userManager.GetUserById(userId);
- if (user is null)
- {
- throw new ResourceNotFoundException();
- }
-
return user.EnableUserPreferenceAccess;
}