mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-05 22:02:53 +01:00
Merge branch 'master' into network-rewrite
This commit is contained in:
@@ -512,12 +512,10 @@ public class ItemsController : BaseJellyfinApiController
|
||||
result = new QueryResult<BaseItem>(itemsArray);
|
||||
}
|
||||
|
||||
// result might include items not accessible by the user, DtoService will remove them
|
||||
var accessibleItems = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user);
|
||||
return new QueryResult<BaseItemDto>(
|
||||
startIndex,
|
||||
accessibleItems.Count,
|
||||
accessibleItems);
|
||||
result.TotalRecordCount,
|
||||
_dtoService.GetBaseItemDtos(result.Items, dtoOptions, user));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -131,6 +131,10 @@ public class StartupController : BaseJellyfinApiController
|
||||
public async Task<ActionResult> UpdateStartupUser([FromBody] StartupUserDto startupUserDto)
|
||||
{
|
||||
var user = _userManager.Users.First();
|
||||
if (string.IsNullOrWhiteSpace(startupUserDto.Password))
|
||||
{
|
||||
return BadRequest("Password must not be empty");
|
||||
}
|
||||
|
||||
if (startupUserDto.Name is not null)
|
||||
{
|
||||
|
||||
@@ -323,36 +323,16 @@ public class UserController : BaseJellyfinApiController
|
||||
/// <response code="404">User not found.</response>
|
||||
/// <returns>A <see cref="NoContentResult"/> indicating success or a <see cref="ForbidResult"/> or a <see cref="NotFoundResult"/> on failure.</returns>
|
||||
[HttpPost("{userId}/EasyPassword")]
|
||||
[Obsolete("Use Quick Connect instead")]
|
||||
[Authorize]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult> UpdateUserEasyPassword(
|
||||
public ActionResult UpdateUserEasyPassword(
|
||||
[FromRoute, Required] Guid userId,
|
||||
[FromBody, Required] UpdateUserEasyPassword request)
|
||||
{
|
||||
if (!RequestHelpers.AssertCanUpdateUser(_userManager, User, userId, true))
|
||||
{
|
||||
return StatusCode(StatusCodes.Status403Forbidden, "User is not allowed to update the easy password.");
|
||||
}
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
if (user is null)
|
||||
{
|
||||
return NotFound("User not found");
|
||||
}
|
||||
|
||||
if (request.ResetPassword)
|
||||
{
|
||||
await _userManager.ResetEasyPassword(user).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _userManager.ChangeEasyPassword(user, request.NewPw ?? string.Empty, request.NewPassword ?? string.Empty).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
return Forbid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user