コード例 #1
0
ファイル: UserManager.cs プロジェクト: zhoucheng8023/jellyfin
        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
            });
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 /// <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;
 }