< Summary - Jellyfin

Information
Class: Jellyfin.Server.Implementations.Events.Consumers.Users.UserLockedOutLogger
Assembly: Jellyfin.Server.Implementations
File(s): /srv/git/jellyfin/Jellyfin.Server.Implementations/Events/Consumers/Users/UserLockedOutLogger.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 47
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Server.Implementations/Events/Consumers/Users/UserLockedOutLogger.cs

#LineLine coverage
 1using System.Globalization;
 2using System.Threading.Tasks;
 3using Jellyfin.Data.Entities;
 4using Jellyfin.Data.Events.Users;
 5using MediaBrowser.Controller.Events;
 6using MediaBrowser.Model.Activity;
 7using MediaBrowser.Model.Globalization;
 8using MediaBrowser.Model.Notifications;
 9using Microsoft.Extensions.Logging;
 10
 11namespace Jellyfin.Server.Implementations.Events.Consumers.Users
 12{
 13    /// <summary>
 14    /// Creates an entry in the activity log when a user is locked out.
 15    /// </summary>
 16    public class UserLockedOutLogger : IEventConsumer<UserLockedOutEventArgs>
 17    {
 18        private readonly ILocalizationManager _localizationManager;
 19        private readonly IActivityManager _activityManager;
 20
 21        /// <summary>
 22        /// Initializes a new instance of the <see cref="UserLockedOutLogger"/> class.
 23        /// </summary>
 24        /// <param name="localizationManager">The localization manager.</param>
 25        /// <param name="activityManager">The activity manager.</param>
 26        public UserLockedOutLogger(ILocalizationManager localizationManager, IActivityManager activityManager)
 27        {
 028            _localizationManager = localizationManager;
 029            _activityManager = activityManager;
 030        }
 31
 32        /// <inheritdoc />
 33        public async Task OnEvent(UserLockedOutEventArgs eventArgs)
 34        {
 35            await _activityManager.CreateAsync(new ActivityLog(
 36                string.Format(
 37                    CultureInfo.InvariantCulture,
 38                    _localizationManager.GetLocalizedString("UserLockedOutWithName"),
 39                    eventArgs.Argument.Username),
 40                NotificationType.UserLockedOut.ToString(),
 41                eventArgs.Argument.Id)
 42            {
 43                LogSeverity = LogLevel.Error
 44            }).ConfigureAwait(false);
 45        }
 46    }
 47}