aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Notifications
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/Notifications')
-rw-r--r--MediaBrowser.Model/Notifications/NotificationLevel.cs11
-rw-r--r--MediaBrowser.Model/Notifications/NotificationOption.cs55
-rw-r--r--MediaBrowser.Model/Notifications/NotificationOptions.cs131
-rw-r--r--MediaBrowser.Model/Notifications/NotificationRequest.cs35
-rw-r--r--MediaBrowser.Model/Notifications/NotificationTypeInfo.cs18
-rw-r--r--MediaBrowser.Model/Notifications/SendToUserType.cs11
6 files changed, 0 insertions, 261 deletions
diff --git a/MediaBrowser.Model/Notifications/NotificationLevel.cs b/MediaBrowser.Model/Notifications/NotificationLevel.cs
deleted file mode 100644
index 14fead3f0..000000000
--- a/MediaBrowser.Model/Notifications/NotificationLevel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma warning disable CS1591
-
-namespace MediaBrowser.Model.Notifications
-{
- public enum NotificationLevel
- {
- Normal = 0,
- Warning = 1,
- Error = 2
- }
-}
diff --git a/MediaBrowser.Model/Notifications/NotificationOption.cs b/MediaBrowser.Model/Notifications/NotificationOption.cs
deleted file mode 100644
index 58aecb3d3..000000000
--- a/MediaBrowser.Model/Notifications/NotificationOption.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma warning disable CA1819 // Properties should not return arrays
-#pragma warning disable CS1591
-
-using System;
-
-namespace MediaBrowser.Model.Notifications
-{
- public class NotificationOption
- {
- public NotificationOption(string type)
- {
- Type = type;
- DisabledServices = Array.Empty<string>();
- DisabledMonitorUsers = Array.Empty<string>();
- SendToUsers = Array.Empty<string>();
- }
-
- public NotificationOption()
- {
- DisabledServices = Array.Empty<string>();
- DisabledMonitorUsers = Array.Empty<string>();
- SendToUsers = Array.Empty<string>();
- }
-
- public string? Type { get; set; }
-
- /// <summary>
- /// Gets or sets user Ids to not monitor (it's opt out).
- /// </summary>
- public string[] DisabledMonitorUsers { get; set; }
-
- /// <summary>
- /// Gets or sets user Ids to send to (if SendToUserMode == Custom).
- /// </summary>
- public string[] SendToUsers { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="NotificationOption"/> is enabled.
- /// </summary>
- /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
- public bool Enabled { get; set; }
-
- /// <summary>
- /// Gets or sets the disabled services.
- /// </summary>
- /// <value>The disabled services.</value>
- public string[] DisabledServices { get; set; }
-
- /// <summary>
- /// Gets or sets the send to user mode.
- /// </summary>
- /// <value>The send to user mode.</value>
- public SendToUserType SendToUserMode { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.cs
deleted file mode 100644
index 804f51e16..000000000
--- a/MediaBrowser.Model/Notifications/NotificationOptions.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-#nullable disable
-#pragma warning disable CS1591
-
-using System;
-using Jellyfin.Data.Entities;
-using Jellyfin.Data.Enums;
-using Jellyfin.Extensions;
-
-namespace MediaBrowser.Model.Notifications
-{
- public class NotificationOptions
- {
- public NotificationOptions()
- {
- Options = new[]
- {
- new NotificationOption(NotificationType.TaskFailed.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.ServerRestartRequired.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.ApplicationUpdateAvailable.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.ApplicationUpdateInstalled.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.PluginUpdateInstalled.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.PluginUninstalled.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.InstallationFailed.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.PluginInstalled.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.PluginError.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- },
- new NotificationOption(NotificationType.UserLockedOut.ToString())
- {
- Enabled = true,
- SendToUserMode = SendToUserType.Admins
- }
- };
- }
-
- public NotificationOption[] Options { get; set; }
-
- public NotificationOption GetOptions(string type)
- {
- foreach (NotificationOption i in Options)
- {
- if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase))
- {
- return i;
- }
- }
-
- return null;
- }
-
- public bool IsEnabled(string type)
- {
- NotificationOption opt = GetOptions(type);
-
- return opt is not null && opt.Enabled;
- }
-
- public bool IsServiceEnabled(string service, string notificationType)
- {
- NotificationOption opt = GetOptions(notificationType);
-
- return opt is null
- || !opt.DisabledServices.Contains(service, StringComparison.OrdinalIgnoreCase);
- }
-
- public bool IsEnabledToMonitorUser(string type, Guid userId)
- {
- NotificationOption opt = GetOptions(type);
-
- return opt is not null
- && opt.Enabled
- && !opt.DisabledMonitorUsers.Contains(userId.ToString("N"), StringComparison.OrdinalIgnoreCase);
- }
-
- public bool IsEnabledToSendToUser(string type, string userId, User user)
- {
- NotificationOption opt = GetOptions(type);
-
- if (opt is not null && opt.Enabled)
- {
- if (opt.SendToUserMode == SendToUserType.All)
- {
- return true;
- }
-
- if (opt.SendToUserMode == SendToUserType.Admins && user.HasPermission(PermissionKind.IsAdministrator))
- {
- return true;
- }
-
- return opt.SendToUsers.Contains(userId, StringComparison.OrdinalIgnoreCase);
- }
-
- return false;
- }
- }
-}
diff --git a/MediaBrowser.Model/Notifications/NotificationRequest.cs b/MediaBrowser.Model/Notifications/NotificationRequest.cs
deleted file mode 100644
index 622c50cd8..000000000
--- a/MediaBrowser.Model/Notifications/NotificationRequest.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-#nullable disable
-#pragma warning disable CS1591
-
-using System;
-
-namespace MediaBrowser.Model.Notifications
-{
- public class NotificationRequest
- {
- public NotificationRequest()
- {
- UserIds = Array.Empty<Guid>();
- Date = DateTime.UtcNow;
- }
-
- public string Name { get; set; }
-
- public string Description { get; set; }
-
- public string Url { get; set; }
-
- public NotificationLevel Level { get; set; }
-
- public Guid[] UserIds { get; set; }
-
- public DateTime Date { get; set; }
-
- /// <summary>
- /// Gets or sets the corresponding type name used in configuration. Not for display.
- /// </summary>
- public string NotificationType { get; set; }
-
- public SendToUserType? SendToUserMode { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs b/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs
deleted file mode 100644
index 402fbe81a..000000000
--- a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-#nullable disable
-#pragma warning disable CS1591
-
-namespace MediaBrowser.Model.Notifications
-{
- public class NotificationTypeInfo
- {
- public string Type { get; set; }
-
- public string Name { get; set; }
-
- public bool Enabled { get; set; }
-
- public string Category { get; set; }
-
- public bool IsBasedOnUserEvent { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Notifications/SendToUserType.cs b/MediaBrowser.Model/Notifications/SendToUserType.cs
deleted file mode 100644
index 65fc4e1ab..000000000
--- a/MediaBrowser.Model/Notifications/SendToUserType.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma warning disable CS1591
-
-namespace MediaBrowser.Model.Notifications
-{
- public enum SendToUserType
- {
- All = 0,
- Admins = 1,
- Custom = 2
- }
-}