From ef178c560671c2a2da284d45798c6b8d88435e1a Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 16 Mar 2021 09:21:27 +0100 Subject: [PATCH] Use explicitly typed notifications instead of generic ones --- .../Cache/DistributedCacheHandler.cs | 32 +++++++++---------- .../Compose/AuditNotificationsHandler.cs | 20 ++++++------ .../Compose/NotificationsComposer.cs | 32 +++++++++---------- .../Events/UserNotificationsHandler.cs | 4 +-- .../FileUploadPropertyEditor.cs | 4 +-- .../ImageCropperPropertyEditor.cs | 4 +-- .../Services/Implement/MemberService.cs | 14 ++++---- .../Services/Implement/PublicAccessService.cs | 16 +++++----- .../Services/Implement/UserService.cs | 28 ++++++++-------- .../MemberDeletedNotification.cs | 15 +++++++++ .../MemberDeletingNotification.cs | 20 ++++++++++++ .../Notifications/MemberSavedNotification.cs | 20 ++++++++++++ .../Notifications/MemberSavingNotification.cs | 20 ++++++++++++ .../PublicAccessEntryDeletedNotification.cs | 15 +++++++++ .../PublicAccessEntryDeletingNotification.cs | 20 ++++++++++++ .../PublicAccessEntrySavedNotification.cs | 20 ++++++++++++ .../PublicAccessEntrySavingNotification.cs | 20 ++++++++++++ .../Notifications/UserDeletedNotification.cs | 15 +++++++++ .../Notifications/UserDeletingNotification.cs | 20 ++++++++++++ .../UserGroupDeletedNotification.cs | 15 +++++++++ .../UserGroupDeletingNotification.cs | 20 ++++++++++++ .../UserGroupSavedNotification.cs | 20 ++++++++++++ .../UserGroupSavingNotification.cs | 20 ++++++++++++ .../UserGroupWithUsersSavedNotification.cs | 19 +++++++++++ .../UserGroupWithUsersSavingNotification.cs | 19 +++++++++++ .../Notifications/UserSavedNotification.cs | 20 ++++++++++++ .../Notifications/UserSavingNotification.cs | 20 ++++++++++++ 27 files changed, 415 insertions(+), 77 deletions(-) create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/MemberDeletedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/MemberDeletingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/MemberSavedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/MemberSavingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserDeletedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserDeletingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavingNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserSavedNotification.cs create mode 100644 src/Umbraco.Infrastructure/Services/Notifications/UserSavingNotification.cs diff --git a/src/Umbraco.Infrastructure/Cache/DistributedCacheHandler.cs b/src/Umbraco.Infrastructure/Cache/DistributedCacheHandler.cs index 648edaca68..793c78f68b 100644 --- a/src/Umbraco.Infrastructure/Cache/DistributedCacheHandler.cs +++ b/src/Umbraco.Infrastructure/Cache/DistributedCacheHandler.cs @@ -8,24 +8,24 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.Cache { internal class DistributedCacheHandler : - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler> + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler { private readonly DistributedCache _distributedCache; public DistributedCacheHandler(DistributedCache distributedCache) => _distributedCache = distributedCache; - public void Handle(SavedNotification notification) => _distributedCache.RefreshMemberCache(notification.SavedEntities.ToArray()); + public void Handle(MemberSavedNotification notification) => _distributedCache.RefreshMemberCache(notification.SavedEntities.ToArray()); - public void Handle(DeletedNotification notification) => _distributedCache.RemoveMemberCache(notification.DeletedEntities.ToArray()); + public void Handle(MemberDeletedNotification notification) => _distributedCache.RemoveMemberCache(notification.DeletedEntities.ToArray()); - public void Handle(SavedNotification notification) + public void Handle(UserSavedNotification notification) { foreach (var entity in notification.SavedEntities) { @@ -33,7 +33,7 @@ namespace Umbraco.Cms.Core.Cache } } - public void Handle(DeletedNotification notification) + public void Handle(UserDeletedNotification notification) { foreach (var entity in notification.DeletedEntities) { @@ -41,7 +41,7 @@ namespace Umbraco.Cms.Core.Cache } } - public void Handle(SavedNotification notification) + public void Handle(UserGroupSavedNotification notification) { foreach (var entity in notification.SavedEntities) { @@ -49,7 +49,7 @@ namespace Umbraco.Cms.Core.Cache } } - public void Handle(DeletedNotification notification) + public void Handle(UserGroupDeletedNotification notification) { foreach (var entity in notification.DeletedEntities) { @@ -57,8 +57,8 @@ namespace Umbraco.Cms.Core.Cache } } - public void Handle(SavedNotification notification) => _distributedCache.RefreshPublicAccess(); + public void Handle(PublicAccessEntrySavedNotification notification) => _distributedCache.RefreshPublicAccess(); - public void Handle(DeletedNotification notification) => _distributedCache.RefreshPublicAccess(); + public void Handle(PublicAccessEntryDeletedNotification notification) => _distributedCache.RefreshPublicAccess(); } } diff --git a/src/Umbraco.Infrastructure/Compose/AuditNotificationsHandler.cs b/src/Umbraco.Infrastructure/Compose/AuditNotificationsHandler.cs index f152dd16cf..e2da324b56 100644 --- a/src/Umbraco.Infrastructure/Compose/AuditNotificationsHandler.cs +++ b/src/Umbraco.Infrastructure/Compose/AuditNotificationsHandler.cs @@ -15,14 +15,14 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.Compose { public sealed class AuditNotificationsHandler : - INotificationHandler>, - INotificationHandler>, + INotificationHandler, + INotificationHandler, INotificationHandler, INotificationHandler, INotificationHandler, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, + INotificationHandler, + INotificationHandler, + INotificationHandler, INotificationHandler { private readonly IAuditService _auditService; @@ -69,7 +69,7 @@ namespace Umbraco.Cms.Core.Compose private string FormatEmail(IUser user) => user == null ? string.Empty : user.Email.IsNullOrWhiteSpace() ? "" : $"<{user.Email}>"; - public void Handle(SavedNotification notification) + public void Handle(MemberSavedNotification notification) { var performingUser = CurrentPerformingUser; var members = notification.SavedEntities; @@ -84,7 +84,7 @@ namespace Umbraco.Cms.Core.Compose } } - public void Handle(DeletedNotification notification) + public void Handle(MemberDeletedNotification notification) { var performingUser = CurrentPerformingUser; var members = notification.DeletedEntities; @@ -138,7 +138,7 @@ namespace Umbraco.Cms.Core.Compose "umbraco/member/exported", "exported member data"); } - public void Handle(SavedNotification notification) + public void Handle(UserSavedNotification notification) { var performingUser = CurrentPerformingUser; var affectedUsers = notification.SavedEntities; @@ -157,7 +157,7 @@ namespace Umbraco.Cms.Core.Compose } } - public void Handle(DeletedNotification notification) + public void Handle(UserDeletedNotification notification) { var performingUser = CurrentPerformingUser; var affectedUsers = notification.DeletedEntities; @@ -168,7 +168,7 @@ namespace Umbraco.Cms.Core.Compose "umbraco/user/delete", "delete user"); } - public void Handle(SavedNotification notification) + public void Handle(UserGroupWithUsersSavedNotification notification) { var performingUser = CurrentPerformingUser; foreach (var groupWithUser in notification.SavedEntities) diff --git a/src/Umbraco.Infrastructure/Compose/NotificationsComposer.cs b/src/Umbraco.Infrastructure/Compose/NotificationsComposer.cs index e79cef4cb1..d973254659 100644 --- a/src/Umbraco.Infrastructure/Compose/NotificationsComposer.cs +++ b/src/Umbraco.Infrastructure/Compose/NotificationsComposer.cs @@ -31,7 +31,7 @@ namespace Umbraco.Cms.Core.Compose .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() - .AddNotificationHandler, UserNotificationsHandler>(); + .AddNotificationHandler(); // add handlers for building content relations builder @@ -51,12 +51,12 @@ namespace Umbraco.Cms.Core.Compose .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() - .AddNotificationHandler, FileUploadPropertyEditor>() + .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() - .AddNotificationHandler, ImageCropperPropertyEditor>(); + .AddNotificationHandler(); // add notification handlers for redirect tracking builder @@ -67,26 +67,26 @@ namespace Umbraco.Cms.Core.Compose // add notification handlers for auditing builder - .AddNotificationHandler, AuditNotificationsHandler>() - .AddNotificationHandler, AuditNotificationsHandler>() + .AddNotificationHandler() + .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() .AddNotificationHandler() - .AddNotificationHandler, AuditNotificationsHandler>() - .AddNotificationHandler, AuditNotificationsHandler>() - .AddNotificationHandler, AuditNotificationsHandler>() + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler() .AddNotificationHandler(); // add notifications handlers for distributed cache builder - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>() - .AddNotificationHandler, DistributedCacheHandler>(); + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler() + .AddNotificationHandler(); } } } diff --git a/src/Umbraco.Infrastructure/Events/UserNotificationsHandler.cs b/src/Umbraco.Infrastructure/Events/UserNotificationsHandler.cs index 719692e38d..933a0fc890 100644 --- a/src/Umbraco.Infrastructure/Events/UserNotificationsHandler.cs +++ b/src/Umbraco.Infrastructure/Events/UserNotificationsHandler.cs @@ -31,7 +31,7 @@ namespace Umbraco.Cms.Core.Events INotificationHandler, INotificationHandler, INotificationHandler, - INotificationHandler> + INotificationHandler { private readonly Notifier _notifier; private readonly ActionCollection _actions; @@ -225,7 +225,7 @@ namespace Umbraco.Cms.Core.Events } - public void Handle(SavedNotification notification) + public void Handle(PublicAccessEntrySavedNotification notification) { var entities = _contentService.GetByIds(notification.SavedEntities.Select(e => e.ProtectedNodeId)).ToArray(); if (entities.Any() == false) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs index 33c31b6ee4..a794d62ce2 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs @@ -28,7 +28,7 @@ namespace Umbraco.Cms.Core.PropertyEditors public class FileUploadPropertyEditor : DataEditor, IMediaUrlGenerator, INotificationHandler, INotificationHandler, INotificationHandler, INotificationHandler, - INotificationHandler> + INotificationHandler { private readonly IMediaFileSystem _mediaFileSystem; private readonly ContentSettings _contentSettings; @@ -160,7 +160,7 @@ namespace Umbraco.Cms.Core.PropertyEditors public void Handle(MediaDeletedNotification notification) => DeleteContainedFiles(notification.DeletedEntities); - public void Handle(DeletedNotification notification) => DeleteContainedFiles(notification.DeletedEntities); + public void Handle(MemberDeletedNotification notification) => DeleteContainedFiles(notification.DeletedEntities); private void DeleteContainedFiles(IEnumerable deletedEntities) { diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs index e96e8582a9..902cb32f08 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs @@ -35,7 +35,7 @@ namespace Umbraco.Cms.Core.PropertyEditors public class ImageCropperPropertyEditor : DataEditor, IMediaUrlGenerator, INotificationHandler, INotificationHandler, INotificationHandler, INotificationHandler, - INotificationHandler> + INotificationHandler { private readonly IMediaFileSystem _mediaFileSystem; private readonly ContentSettings _contentSettings; @@ -216,7 +216,7 @@ namespace Umbraco.Cms.Core.PropertyEditors public void Handle(MediaDeletedNotification notification) => DeleteContainedFiles(notification.DeletedEntities); - public void Handle(DeletedNotification notification) => DeleteContainedFiles(notification.DeletedEntities); + public void Handle(MemberDeletedNotification notification) => DeleteContainedFiles(notification.DeletedEntities); private void DeleteContainedFiles(IEnumerable deletedEntities) { diff --git a/src/Umbraco.Infrastructure/Services/Implement/MemberService.cs b/src/Umbraco.Infrastructure/Services/Implement/MemberService.cs index 026052fa67..fd5c9480a7 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/MemberService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/MemberService.cs @@ -777,7 +777,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (IScope scope = ScopeProvider.CreateScope()) { - var savingNotification = new SavingNotification(member, evtMsgs); + var savingNotification = new MemberSavingNotification(member, evtMsgs); if (raiseEvents && scope.Notifications.PublishCancelable(savingNotification)) { scope.Complete(); @@ -795,7 +795,7 @@ namespace Umbraco.Cms.Core.Services.Implement if (raiseEvents) { - scope.Notifications.Publish(new SavedNotification(member, evtMsgs).WithStateFrom(savingNotification)); + scope.Notifications.Publish(new MemberSavedNotification(member, evtMsgs).WithStateFrom(savingNotification)); } Audit(AuditType.Save, 0, member.Id); @@ -813,7 +813,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var savingNotification = new SavingNotification(membersA, evtMsgs); + var savingNotification = new MemberSavingNotification(membersA, evtMsgs); if (raiseEvents && scope.Notifications.PublishCancelable(savingNotification)) { scope.Complete(); @@ -833,7 +833,7 @@ namespace Umbraco.Cms.Core.Services.Implement if (raiseEvents) { - scope.Notifications.Publish(new SavedNotification(membersA, evtMsgs).WithStateFrom(savingNotification)); + scope.Notifications.Publish(new MemberSavedNotification(membersA, evtMsgs).WithStateFrom(savingNotification)); } Audit(AuditType.Save, 0, -1, "Save multiple Members"); @@ -855,7 +855,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var deletingNotification = new DeletingNotification(member, evtMsgs); + var deletingNotification = new MemberDeletingNotification(member, evtMsgs); if (scope.Notifications.PublishCancelable(deletingNotification)) { scope.Complete(); @@ -874,7 +874,7 @@ namespace Umbraco.Cms.Core.Services.Implement { // a member has no descendants _memberRepository.Delete(member); - scope.Notifications.Publish(new DeletedNotification(member, evtMsgs).WithState(notificationState)); + scope.Notifications.Publish(new MemberDeletedNotification(member, evtMsgs).WithState(notificationState)); // media files deleted by QueuingEventDispatcher } @@ -1165,7 +1165,7 @@ namespace Umbraco.Cms.Core.Services.Implement IMember[] members = _memberRepository.Get(query).ToArray(); - if (scope.Notifications.PublishCancelable(new DeletingNotification(members, evtMsgs))) + if (scope.Notifications.PublishCancelable(new MemberDeletingNotification(members, evtMsgs))) { scope.Complete(); return; diff --git a/src/Umbraco.Infrastructure/Services/Implement/PublicAccessService.cs b/src/Umbraco.Infrastructure/Services/Implement/PublicAccessService.cs index 57df102620..b79b0ec0ab 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/PublicAccessService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/PublicAccessService.cs @@ -128,7 +128,7 @@ namespace Umbraco.Cms.Core.Services.Implement return OperationResult.Attempt.Succeed(evtMsgs, entry); } - var savingNotifiation = new SavingNotification(entry, evtMsgs); + var savingNotifiation = new PublicAccessEntrySavingNotification(entry, evtMsgs); if (scope.Notifications.PublishCancelable(savingNotifiation)) { scope.Complete(); @@ -139,7 +139,7 @@ namespace Umbraco.Cms.Core.Services.Implement scope.Complete(); - scope.Notifications.Publish(new SavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation)); + scope.Notifications.Publish(new PublicAccessEntrySavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation)); } return OperationResult.Attempt.Succeed(evtMsgs, entry); @@ -165,7 +165,7 @@ namespace Umbraco.Cms.Core.Services.Implement entry.RemoveRule(existingRule); - var savingNotifiation = new SavingNotification(entry, evtMsgs); + var savingNotifiation = new PublicAccessEntrySavingNotification(entry, evtMsgs); if (scope.Notifications.PublishCancelable(savingNotifiation)) { scope.Complete(); @@ -175,7 +175,7 @@ namespace Umbraco.Cms.Core.Services.Implement _publicAccessRepository.Save(entry); scope.Complete(); - scope.Notifications.Publish(new SavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation)); + scope.Notifications.Publish(new PublicAccessEntrySavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation)); } return OperationResult.Attempt.Succeed(evtMsgs); @@ -191,7 +191,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var savingNotifiation = new SavingNotification(entry, evtMsgs); + var savingNotifiation = new PublicAccessEntrySavingNotification(entry, evtMsgs); if (scope.Notifications.PublishCancelable(savingNotifiation)) { scope.Complete(); @@ -201,7 +201,7 @@ namespace Umbraco.Cms.Core.Services.Implement _publicAccessRepository.Save(entry); scope.Complete(); - scope.Notifications.Publish(new SavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation)); + scope.Notifications.Publish(new PublicAccessEntrySavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation)); } return OperationResult.Attempt.Succeed(evtMsgs); @@ -217,7 +217,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var deletingNotification = new DeletingNotification(entry, evtMsgs); + var deletingNotification = new PublicAccessEntryDeletingNotification(entry, evtMsgs); if (scope.Notifications.PublishCancelable(deletingNotification)) { scope.Complete(); @@ -227,7 +227,7 @@ namespace Umbraco.Cms.Core.Services.Implement _publicAccessRepository.Delete(entry); scope.Complete(); - scope.Notifications.Publish(new DeletedNotification(entry, evtMsgs).WithStateFrom(deletingNotification)); + scope.Notifications.Publish(new PublicAccessEntryDeletedNotification(entry, evtMsgs).WithStateFrom(deletingNotification)); } return OperationResult.Attempt.Succeed(evtMsgs); diff --git a/src/Umbraco.Infrastructure/Services/Implement/UserService.cs b/src/Umbraco.Infrastructure/Services/Implement/UserService.cs index 3336ba37a3..4fbe579ca3 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/UserService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/UserService.cs @@ -132,7 +132,7 @@ namespace Umbraco.Cms.Core.Services.Implement IsApproved = isApproved }; - var savingNotification = new SavingNotification(user, evtMsgs); + var savingNotification = new UserSavingNotification(user, evtMsgs); if (scope.Notifications.PublishCancelable(savingNotification)) { scope.Complete(); @@ -141,7 +141,7 @@ namespace Umbraco.Cms.Core.Services.Implement _userRepository.Save(user); - scope.Notifications.Publish(new SavedNotification(user, evtMsgs).WithStateFrom(savingNotification)); + scope.Notifications.Publish(new UserSavedNotification(user, evtMsgs).WithStateFrom(savingNotification)); scope.Complete(); } @@ -245,7 +245,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var deletingNotification = new DeletingNotification(user, evtMsgs); + var deletingNotification = new UserDeletingNotification(user, evtMsgs); if (scope.Notifications.PublishCancelable(deletingNotification)) { scope.Complete(); @@ -254,7 +254,7 @@ namespace Umbraco.Cms.Core.Services.Implement _userRepository.Delete(user); - scope.Notifications.Publish(new DeletedNotification(user, evtMsgs).WithStateFrom(deletingNotification)); + scope.Notifications.Publish(new UserDeletedNotification(user, evtMsgs).WithStateFrom(deletingNotification)); scope.Complete(); } } @@ -279,7 +279,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var savingNotification = new SavingNotification(entity, evtMsgs); + var savingNotification = new UserSavingNotification(entity, evtMsgs); if (raiseEvents && scope.Notifications.PublishCancelable(savingNotification)) { scope.Complete(); @@ -297,7 +297,7 @@ namespace Umbraco.Cms.Core.Services.Implement _userRepository.Save(entity); if (raiseEvents) { - scope.Notifications.Publish(new SavedNotification(entity, evtMsgs).WithStateFrom(savingNotification)); + scope.Notifications.Publish(new UserSavedNotification(entity, evtMsgs).WithStateFrom(savingNotification)); } scope.Complete(); @@ -329,7 +329,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var savingNotification = new SavingNotification(entitiesA, evtMsgs); + var savingNotification = new UserSavingNotification(entitiesA, evtMsgs); if (raiseEvents && scope.Notifications.PublishCancelable(savingNotification)) { scope.Complete(); @@ -350,7 +350,7 @@ namespace Umbraco.Cms.Core.Services.Implement if (raiseEvents) { - scope.Notifications.Publish(new SavedNotification(entitiesA, evtMsgs).WithStateFrom(savingNotification)); + scope.Notifications.Publish(new UserSavedNotification(entitiesA, evtMsgs).WithStateFrom(savingNotification)); } //commit the whole lot in one go @@ -840,7 +840,7 @@ namespace Umbraco.Cms.Core.Services.Implement var userGroupWithUsers = new UserGroupWithUsers(userGroup, addedUsers, removedUsers); // this is the default/expected notification for the IUserGroup entity being saved - var savingNotification = new SavingNotification(userGroup, evtMsgs); + var savingNotification = new UserGroupSavingNotification(userGroup, evtMsgs); if (raiseEvents && scope.Notifications.PublishCancelable(savingNotification)) { scope.Complete(); @@ -848,7 +848,7 @@ namespace Umbraco.Cms.Core.Services.Implement } // this is an additional notification for special auditing - var savingUserGroupWithUsersNotification = new SavingNotification(userGroupWithUsers, evtMsgs); + var savingUserGroupWithUsersNotification = new UserGroupWithUsersSavingNotification(userGroupWithUsers, evtMsgs); if (raiseEvents && scope.Notifications.PublishCancelable(savingUserGroupWithUsersNotification)) { scope.Complete(); @@ -859,8 +859,8 @@ namespace Umbraco.Cms.Core.Services.Implement if (raiseEvents) { - scope.Notifications.Publish(new SavedNotification(userGroup, evtMsgs).WithStateFrom(savingNotification)); - scope.Notifications.Publish(new SavedNotification(userGroupWithUsers, evtMsgs).WithStateFrom(savingUserGroupWithUsersNotification)); + scope.Notifications.Publish(new UserGroupSavedNotification(userGroup, evtMsgs).WithStateFrom(savingNotification)); + scope.Notifications.Publish(new UserGroupWithUsersSavedNotification(userGroupWithUsers, evtMsgs).WithStateFrom(savingUserGroupWithUsersNotification)); } scope.Complete(); @@ -877,7 +877,7 @@ namespace Umbraco.Cms.Core.Services.Implement using (var scope = ScopeProvider.CreateScope()) { - var deletingNotification = new DeletingNotification(userGroup, evtMsgs); + var deletingNotification = new UserGroupDeletingNotification(userGroup, evtMsgs); if (scope.Notifications.PublishCancelable(deletingNotification)) { scope.Complete(); @@ -886,7 +886,7 @@ namespace Umbraco.Cms.Core.Services.Implement _userGroupRepository.Delete(userGroup); - scope.Notifications.Publish(new DeletedNotification(userGroup, evtMsgs).WithStateFrom(deletingNotification)); + scope.Notifications.Publish(new UserGroupDeletedNotification(userGroup, evtMsgs).WithStateFrom(deletingNotification)); scope.Complete(); } diff --git a/src/Umbraco.Infrastructure/Services/Notifications/MemberDeletedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/MemberDeletedNotification.cs new file mode 100644 index 0000000000..41edd5371e --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/MemberDeletedNotification.cs @@ -0,0 +1,15 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class MemberDeletedNotification : DeletedNotification + { + public MemberDeletedNotification(IMember target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/MemberDeletingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/MemberDeletingNotification.cs new file mode 100644 index 0000000000..4a4cd585c5 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/MemberDeletingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class MemberDeletingNotification : DeletingNotification + { + public MemberDeletingNotification(IMember target, EventMessages messages) : base(target, messages) + { + } + + public MemberDeletingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/MemberSavedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/MemberSavedNotification.cs new file mode 100644 index 0000000000..6ea4e38870 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/MemberSavedNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class MemberSavedNotification : SavedNotification + { + public MemberSavedNotification(IMember target, EventMessages messages) : base(target, messages) + { + } + + public MemberSavedNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/MemberSavingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/MemberSavingNotification.cs new file mode 100644 index 0000000000..8496731304 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/MemberSavingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class MemberSavingNotification : SavingNotification + { + public MemberSavingNotification(IMember target, EventMessages messages) : base(target, messages) + { + } + + public MemberSavingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletedNotification.cs new file mode 100644 index 0000000000..03f48dff5c --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletedNotification.cs @@ -0,0 +1,15 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class PublicAccessEntryDeletedNotification : DeletedNotification + { + public PublicAccessEntryDeletedNotification(PublicAccessEntry target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletingNotification.cs new file mode 100644 index 0000000000..521a86caff --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntryDeletingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class PublicAccessEntryDeletingNotification : DeletingNotification + { + public PublicAccessEntryDeletingNotification(PublicAccessEntry target, EventMessages messages) : base(target, messages) + { + } + + public PublicAccessEntryDeletingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavedNotification.cs new file mode 100644 index 0000000000..ec1781a3d4 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavedNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class PublicAccessEntrySavedNotification : SavedNotification + { + public PublicAccessEntrySavedNotification(PublicAccessEntry target, EventMessages messages) : base(target, messages) + { + } + + public PublicAccessEntrySavedNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavingNotification.cs new file mode 100644 index 0000000000..63f4a490a3 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/PublicAccessEntrySavingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class PublicAccessEntrySavingNotification : SavingNotification + { + public PublicAccessEntrySavingNotification(PublicAccessEntry target, EventMessages messages) : base(target, messages) + { + } + + public PublicAccessEntrySavingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserDeletedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserDeletedNotification.cs new file mode 100644 index 0000000000..3173647652 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserDeletedNotification.cs @@ -0,0 +1,15 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserDeletedNotification : DeletedNotification + { + public UserDeletedNotification(IUser target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserDeletingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserDeletingNotification.cs new file mode 100644 index 0000000000..1f57755a5a --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserDeletingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserDeletingNotification : DeletingNotification + { + public UserDeletingNotification(IUser target, EventMessages messages) : base(target, messages) + { + } + + public UserDeletingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletedNotification.cs new file mode 100644 index 0000000000..a9c51dc72d --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletedNotification.cs @@ -0,0 +1,15 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserGroupDeletedNotification : DeletedNotification + { + public UserGroupDeletedNotification(IUserGroup target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletingNotification.cs new file mode 100644 index 0000000000..c176e55456 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupDeletingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserGroupDeletingNotification : DeletingNotification + { + public UserGroupDeletingNotification(IUserGroup target, EventMessages messages) : base(target, messages) + { + } + + public UserGroupDeletingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavedNotification.cs new file mode 100644 index 0000000000..b542b35b26 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavedNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserGroupSavedNotification : SavedNotification + { + public UserGroupSavedNotification(IUserGroup target, EventMessages messages) : base(target, messages) + { + } + + public UserGroupSavedNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavingNotification.cs new file mode 100644 index 0000000000..136b2da6a5 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupSavingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserGroupSavingNotification : SavingNotification + { + public UserGroupSavingNotification(IUserGroup target, EventMessages messages) : base(target, messages) + { + } + + public UserGroupSavingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavedNotification.cs new file mode 100644 index 0000000000..22e0d67d06 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavedNotification.cs @@ -0,0 +1,19 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserGroupWithUsersSavedNotification : SavedNotification + { + public UserGroupWithUsersSavedNotification(UserGroupWithUsers target, EventMessages messages) : base(target, messages) + { + } + + public UserGroupWithUsersSavedNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavingNotification.cs new file mode 100644 index 0000000000..c61087038a --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserGroupWithUsersSavingNotification.cs @@ -0,0 +1,19 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserGroupWithUsersSavingNotification : SavingNotification + { + public UserGroupWithUsersSavingNotification(UserGroupWithUsers target, EventMessages messages) : base(target, messages) + { + } + + public UserGroupWithUsersSavingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserSavedNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserSavedNotification.cs new file mode 100644 index 0000000000..850085ae90 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserSavedNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserSavedNotification : SavedNotification + { + public UserSavedNotification(IUser target, EventMessages messages) : base(target, messages) + { + } + + public UserSavedNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +} diff --git a/src/Umbraco.Infrastructure/Services/Notifications/UserSavingNotification.cs b/src/Umbraco.Infrastructure/Services/Notifications/UserSavingNotification.cs new file mode 100644 index 0000000000..0b062c33f1 --- /dev/null +++ b/src/Umbraco.Infrastructure/Services/Notifications/UserSavingNotification.cs @@ -0,0 +1,20 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Models.Membership; + +namespace Umbraco.Cms.Infrastructure.Services.Notifications +{ + public sealed class UserSavingNotification : SavingNotification + { + public UserSavingNotification(IUser target, EventMessages messages) : base(target, messages) + { + } + + public UserSavingNotification(IEnumerable target, EventMessages messages) : base(target, messages) + { + } + } +}