Merge branch 'v8/8.6' into v8/dev

# Conflicts:
#	src/Umbraco.Web/Security/MembershipHelper.cs
This commit is contained in:
Sebastiaan Janssen
2020-09-23 11:09:40 +02:00
28 changed files with 666 additions and 231 deletions

View File

@@ -35,7 +35,19 @@ namespace Umbraco.Web.Compose
}
public void Terminate()
{ }
{
//BackOfficeUserManager.AccountLocked -= ;
//BackOfficeUserManager.AccountUnlocked -= ;
BackOfficeUserManager.ForgotPasswordRequested -= OnForgotPasswordRequest;
BackOfficeUserManager.ForgotPasswordChangedSuccess -= OnForgotPasswordChange;
BackOfficeUserManager.LoginFailed -= OnLoginFailed;
//BackOfficeUserManager.LoginRequiresVerification -= ;
BackOfficeUserManager.LoginSuccess -= OnLoginSuccess;
BackOfficeUserManager.LogoutSuccess -= OnLogoutSuccess;
BackOfficeUserManager.PasswordChanged -= OnPasswordChanged;
BackOfficeUserManager.PasswordReset -= OnPasswordReset;
//BackOfficeUserManager.ResetAccessFailedCount -= ;
}
private IUser GetPerformingUser(int userId)
{

View File

@@ -32,42 +32,78 @@ namespace Umbraco.Web.Compose
public void Initialize()
{
//Send notifications for the send to publish action
ContentService.SentToPublish += (sender, args) => _notifier.Notify(_actions.GetAction<ActionToPublish>(), args.Entity);
ContentService.SentToPublish += ContentService_SentToPublish;
//Send notifications for the published action
ContentService.Published += (sender, args) => _notifier.Notify(_actions.GetAction<ActionPublish>(), args.PublishedEntities.ToArray());
ContentService.Published += ContentService_Published;
//Send notifications for the saved action
ContentService.Sorted += (sender, args) => ContentServiceSorted(_notifier, sender, args, _actions);
ContentService.Sorted += ContentService_Sorted;
//Send notifications for the update and created actions
ContentService.Saved += (sender, args) => ContentServiceSaved(_notifier, sender, args, _actions);
ContentService.Saved += ContentService_Saved;
//Send notifications for the unpublish action
ContentService.Unpublished += (sender, args) => _notifier.Notify(_actions.GetAction<ActionUnpublish>(), args.PublishedEntities.ToArray());
ContentService.Unpublished += ContentService_Unpublished;
//Send notifications for the move/move to recycle bin and restore actions
ContentService.Moved += (sender, args) => ContentServiceMoved(_notifier, sender, args, _actions);
ContentService.Moved += ContentService_Moved;
//Send notifications for the delete action when content is moved to the recycle bin
ContentService.Trashed += (sender, args) => _notifier.Notify(_actions.GetAction<ActionDelete>(), args.MoveInfoCollection.Select(m => m.Entity).ToArray());
ContentService.Trashed += ContentService_Trashed;
//Send notifications for the copy action
ContentService.Copied += (sender, args) => _notifier.Notify(_actions.GetAction<ActionCopy>(), args.Original);
ContentService.Copied += ContentService_Copied;
//Send notifications for the rollback action
ContentService.RolledBack += (sender, args) => _notifier.Notify(_actions.GetAction<ActionRollback>(), args.Entity);
ContentService.RolledBack += ContentService_RolledBack;
//Send notifications for the public access changed action
PublicAccessService.Saved += (sender, args) => PublicAccessServiceSaved(_notifier, sender, args, _contentService, _actions);
UserService.UserGroupPermissionsAssigned += (sender, args) => UserServiceUserGroupPermissionsAssigned(_notifier, sender, args, _contentService, _actions);
PublicAccessService.Saved += PublicAccessService_Saved;
UserService.UserGroupPermissionsAssigned += UserService_UserGroupPermissionsAssigned;
}
public void Terminate()
{ }
{
ContentService.SentToPublish -= ContentService_SentToPublish;
ContentService.Published -= ContentService_Published;
ContentService.Sorted -= ContentService_Sorted;
ContentService.Saved -= ContentService_Saved;
ContentService.Unpublished -= ContentService_Unpublished;
ContentService.Moved -= ContentService_Moved;
ContentService.Trashed -= ContentService_Trashed;
ContentService.Copied -= ContentService_Copied;
ContentService.RolledBack -= ContentService_RolledBack;
PublicAccessService.Saved -= PublicAccessService_Saved;
UserService.UserGroupPermissionsAssigned -= UserService_UserGroupPermissionsAssigned;
}
private void ContentServiceSorted(Notifier notifier, IContentService sender, Core.Events.SaveEventArgs<IContent> args, ActionCollection actions)
private void UserService_UserGroupPermissionsAssigned(IUserService sender, Core.Events.SaveEventArgs<EntityPermission> args)
=> UserServiceUserGroupPermissionsAssigned(args, _contentService);
private void PublicAccessService_Saved(IPublicAccessService sender, Core.Events.SaveEventArgs<PublicAccessEntry> args)
=> PublicAccessServiceSaved(args, _contentService);
private void ContentService_RolledBack(IContentService sender, Core.Events.RollbackEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionRollback>(), args.Entity);
private void ContentService_Copied(IContentService sender, Core.Events.CopyEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionCopy>(), args.Original);
private void ContentService_Trashed(IContentService sender, Core.Events.MoveEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionDelete>(), args.MoveInfoCollection.Select(m => m.Entity).ToArray());
private void ContentService_Moved(IContentService sender, Core.Events.MoveEventArgs<IContent> args)
=> ContentServiceMoved(args);
private void ContentService_Unpublished(IContentService sender, Core.Events.PublishEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionUnpublish>(), args.PublishedEntities.ToArray());
private void ContentService_Saved(IContentService sender, Core.Events.ContentSavedEventArgs args)
=> ContentServiceSaved(args);
private void ContentService_Sorted(IContentService sender, Core.Events.SaveEventArgs<IContent> args)
=> ContentServiceSorted(sender, args);
private void ContentService_Published(IContentService sender, Core.Events.ContentPublishedEventArgs args)
=> _notifier.Notify(_actions.GetAction<ActionPublish>(), args.PublishedEntities.ToArray());
private void ContentService_SentToPublish(IContentService sender, Core.Events.SendToPublishEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionToPublish>(), args.Entity);
private void ContentServiceSorted(IContentService sender, Core.Events.SaveEventArgs<IContent> args)
{
var parentId = args.SavedEntities.Select(x => x.ParentId).Distinct().ToList();
if (parentId.Count != 1) return; // this shouldn't happen, for sorting all entities will have the same parent id
@@ -79,10 +115,10 @@ namespace Umbraco.Web.Compose
var parent = sender.GetById(parentId[0]);
if (parent == null) return; // this shouldn't happen
notifier.Notify(actions.GetAction<ActionSort>(), new[] { parent });
_notifier.Notify(_actions.GetAction<ActionSort>(), new[] { parent });
}
private void ContentServiceSaved(Notifier notifier, IContentService sender, Core.Events.SaveEventArgs<IContent> args, ActionCollection actions)
private void ContentServiceSaved(Core.Events.SaveEventArgs<IContent> args)
{
var newEntities = new List<IContent>();
var updatedEntities = new List<IContent>();
@@ -102,21 +138,21 @@ namespace Umbraco.Web.Compose
updatedEntities.Add(entity);
}
}
notifier.Notify(actions.GetAction<ActionNew>(), newEntities.ToArray());
notifier.Notify(actions.GetAction<ActionUpdate>(), updatedEntities.ToArray());
_notifier.Notify(_actions.GetAction<ActionNew>(), newEntities.ToArray());
_notifier.Notify(_actions.GetAction<ActionUpdate>(), updatedEntities.ToArray());
}
private void UserServiceUserGroupPermissionsAssigned(Notifier notifier, IUserService sender, Core.Events.SaveEventArgs<EntityPermission> args, IContentService contentService, ActionCollection actions)
private void UserServiceUserGroupPermissionsAssigned(Core.Events.SaveEventArgs<EntityPermission> args, IContentService contentService)
{
var entities = contentService.GetByIds(args.SavedEntities.Select(e => e.EntityId)).ToArray();
if(entities.Any() == false)
if (entities.Any() == false)
{
return;
}
notifier.Notify(actions.GetAction<ActionRights>(), entities);
_notifier.Notify(_actions.GetAction<ActionRights>(), entities);
}
private void ContentServiceMoved(Notifier notifier, IContentService sender, Core.Events.MoveEventArgs<IContent> args, ActionCollection actions)
private void ContentServiceMoved(Core.Events.MoveEventArgs<IContent> args)
{
// notify about the move for all moved items
_notifier.Notify(_actions.GetAction<ActionMove>(), args.MoveInfoCollection.Select(m => m.Entity).ToArray());
@@ -126,22 +162,22 @@ namespace Umbraco.Web.Compose
.Where(m => m.OriginalPath.Contains(Constants.System.RecycleBinContentString))
.Select(m => m.Entity)
.ToArray();
if(restoredEntities.Any())
if (restoredEntities.Any())
{
_notifier.Notify(_actions.GetAction<ActionRestore>(), restoredEntities);
}
}
private void PublicAccessServiceSaved(Notifier notifier, IPublicAccessService sender, Core.Events.SaveEventArgs<PublicAccessEntry> args, IContentService contentService, ActionCollection actions)
private void PublicAccessServiceSaved(Core.Events.SaveEventArgs<PublicAccessEntry> args, IContentService contentService)
{
var entities = contentService.GetByIds(args.SavedEntities.Select(e => e.ProtectedNodeId)).ToArray();
if(entities.Any() == false)
if (entities.Any() == false)
{
return;
}
notifier.Notify(actions.GetAction<ActionProtect>(), entities);
_notifier.Notify(_actions.GetAction<ActionProtect>(), entities);
}
/// <summary>
/// This class is used to send the notifications
/// </summary>

View File

@@ -14,7 +14,9 @@ namespace Umbraco.Web.Compose
}
public void Terminate()
{ }
{
MemberGroupService.Saved -= MemberGroupService_Saved;
}
static void MemberGroupService_Saved(IMemberGroupService sender, Core.Events.SaveEventArgs<Core.Models.IMemberGroup> e)
{