internal async Task <User> CreateUserInternalAsync(string name, JellyfinDb dbContext) { // TODO: Remove after user item data is migrated. var max = await dbContext.Users.AnyAsync().ConfigureAwait(false) ? await dbContext.Users.Select(u => u.InternalId).MaxAsync().ConfigureAwait(false) : 0; return(new User( name, _defaultAuthenticationProvider.GetType().FullName, _defaultPasswordResetProvider.GetType().FullName) { InternalId = max + 1 }); }
internal async Task <User> CreateUserInternalAsync(string name, JellyfinDb dbContext) { // TODO: Remove after user item data is migrated. var max = await dbContext.Users.AsQueryable().AnyAsync().ConfigureAwait(false) ? await dbContext.Users.AsQueryable().Select(u => u.InternalId).MaxAsync().ConfigureAwait(false) : 0; var user = new User( name, _defaultAuthenticationProvider.GetType().FullName !, _defaultPasswordResetProvider.GetType().FullName !) { InternalId = max + 1 }; user.AddDefaultPermissions(); user.AddDefaultPreferences(); _users.Add(user.Id, user); return(user); }
/// <summary> /// Initializes a new instance of the <see cref="DisplayPreferencesManager"/> class. /// </summary> /// <param name="dbContext">The database context.</param> public DisplayPreferencesManager(JellyfinDb dbContext) { _dbContext = dbContext; }