@ -381,17 +381,13 @@ namespace Jellyfin.Api.Controllers
var user = _userManager . GetUserById ( userId ) ;
var user = _userManager . GetUserById ( userId ) ;
if ( string . Equals ( user . Username , updateUser . Name , StringComparison . Ordinal ) )
if ( ! string . Equals ( user . Username , updateUser . Name , StringComparison . Ordinal ) )
{
await _userManager . UpdateUserAsync ( user ) . ConfigureAwait ( false ) ;
_userManager . UpdateConfiguration ( user . Id , updateUser . Configuration ) ;
}
else
{
{
await _userManager . RenameUser ( user , updateUser . Name ) . ConfigureAwait ( false ) ;
await _userManager . RenameUser ( user , updateUser . Name ) . ConfigureAwait ( false ) ;
_userManager . UpdateConfiguration ( updateUser . Id , updateUser . Configuration ) ;
}
}
await _userManager . UpdateConfigurationAsync ( user . Id , updateUser . Configuration ) . ConfigureAwait ( false ) ;
return NoContent ( ) ;
return NoContent ( ) ;
}
}
@ -409,7 +405,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public ActionResult UpdateUserPolicy (
public async Task < ActionResult > UpdateUserPolicy (
[FromRoute, Required] Guid userId ,
[FromRoute, Required] Guid userId ,
[FromBody] UserPolicy newPolicy )
[FromBody] UserPolicy newPolicy )
{
{
@ -447,7 +443,7 @@ namespace Jellyfin.Api.Controllers
_sessionManager . RevokeUserTokens ( user . Id , currentToken ) ;
_sessionManager . RevokeUserTokens ( user . Id , currentToken ) ;
}
}
_userManager . UpdatePolicy ( userId , newPolicy ) ;
await _userManager . UpdatePolicy Async ( userId , newPolicy ) . ConfigureAwait ( false ) ;
return NoContent ( ) ;
return NoContent ( ) ;
}
}
@ -464,7 +460,7 @@ namespace Jellyfin.Api.Controllers
[Authorize(Policy = Policies.DefaultAuthorization)]
[Authorize(Policy = Policies.DefaultAuthorization)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public ActionResult UpdateUserConfiguration (
public async Task < ActionResult > UpdateUserConfiguration (
[FromRoute, Required] Guid userId ,
[FromRoute, Required] Guid userId ,
[FromBody] UserConfiguration userConfig )
[FromBody] UserConfiguration userConfig )
{
{
@ -473,7 +469,7 @@ namespace Jellyfin.Api.Controllers
return Forbid ( "User configuration update not allowed" ) ;
return Forbid ( "User configuration update not allowed" ) ;
}
}
_userManager . UpdateConfiguration ( userId , userConfig ) ;
await _userManager . UpdateConfiguration Async ( userId , userConfig ) . ConfigureAwait ( false ) ;
return NoContent ( ) ;
return NoContent ( ) ;
}
}