Apply suggestions

This commit is contained in:
Patrick Barron 2020-10-27 12:12:08 -04:00
parent aff8684d2e
commit f051590f14

View File

@ -49,7 +49,7 @@ namespace Jellyfin.Server.Implementations.Users
private readonly DefaultAuthenticationProvider _defaultAuthenticationProvider; private readonly DefaultAuthenticationProvider _defaultAuthenticationProvider;
private readonly DefaultPasswordResetProvider _defaultPasswordResetProvider; private readonly DefaultPasswordResetProvider _defaultPasswordResetProvider;
private readonly IDictionary<Guid, User> _users = new ConcurrentDictionary<Guid, User>(); private readonly IDictionary<Guid, User> _users;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UserManager"/> class. /// Initializes a new instance of the <see cref="UserManager"/> class.
@ -85,6 +85,7 @@ namespace Jellyfin.Server.Implementations.Users
_defaultAuthenticationProvider = _authenticationProviders.OfType<DefaultAuthenticationProvider>().First(); _defaultAuthenticationProvider = _authenticationProviders.OfType<DefaultAuthenticationProvider>().First();
_defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First(); _defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First();
_users = new ConcurrentDictionary<Guid, User>();
using var dbContext = _dbProvider.CreateContext(); using var dbContext = _dbProvider.CreateContext();
foreach (var user in dbContext.Users foreach (var user in dbContext.Users
.Include(user => user.Permissions) .Include(user => user.Permissions)
@ -101,16 +102,10 @@ namespace Jellyfin.Server.Implementations.Users
public event EventHandler<GenericEventArgs<User>>? OnUserUpdated; public event EventHandler<GenericEventArgs<User>>? OnUserUpdated;
/// <inheritdoc/> /// <inheritdoc/>
public IEnumerable<User> Users public IEnumerable<User> Users => _users.Values;
{
get { return _users.Values; }
}
/// <inheritdoc/> /// <inheritdoc/>
public IEnumerable<Guid> UsersIds public IEnumerable<Guid> UsersIds => _users.Keys;
{
get { return _users.Keys; }
}
/// <inheritdoc/> /// <inheritdoc/>
public User? GetUserById(Guid id) public User? GetUserById(Guid id)