Merge branch 'netcore/dev' into netcore/members-userstore

# Conflicts:
#	src/Umbraco.Core/Models/Membership/IMembershipUser.cs
#	src/Umbraco.Core/Models/Membership/IUser.cs
#	src/Umbraco.Core/Services/IMembershipRoleService.cs
#	src/Umbraco.Infrastructure/Compose/AuditEventsComponent.cs
#	src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.MappingProfiles.cs
#	src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Services.cs
#	src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
#	src/Umbraco.Infrastructure/Security/BackOfficeIdentityUser.cs
#	src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
#	src/Umbraco.Infrastructure/Security/IBackOfficeUserPasswordChecker.cs
#	src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
#	src/Umbraco.Infrastructure/Security/IdentityMapDefinition.cs
#	src/Umbraco.Infrastructure/Security/SignOutAuditEventArgs.cs
#	src/Umbraco.Infrastructure/Security/UmbracoUserManager.cs
#	src/Umbraco.Infrastructure/Services/Implement/MemberService.cs
#	src/Umbraco.Tests.Integration/TestServerTest/TestAuthHandler.cs
#	src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/UmbracoBackOfficeServiceCollectionExtensionsTests.cs
#	src/Umbraco.Tests.UnitTests/AutoFixture/AutoMoqDataAttribute.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizerTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Security/NoOpLookupNormalizerTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerTests.cs
#	src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
#	src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
#	src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
#	src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
#	src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
#	src/Umbraco.Web.BackOffice/DependencyInjection/ServiceCollectionExtensions.cs
#	src/Umbraco.Web.BackOffice/Filters/CheckIfUserTicketDataIsStaleAttribute.cs
#	src/Umbraco.Web.BackOffice/Mapping/MemberMapDefinition.cs
#	src/Umbraco.Web.BackOffice/Security/BackOfficePasswordHasher.cs
#	src/Umbraco.Web.BackOffice/Security/BackOfficeSecurityStampValidator.cs
#	src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
#	src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs
#	src/Umbraco.Web.BackOffice/Security/BackOfficeUserManagerAuditer.cs
#	src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
#	src/Umbraco.Web.BackOffice/Security/ExternalSignInAutoLinkOptions.cs
#	src/Umbraco.Web.BackOffice/Security/IBackOfficeSignInManager.cs
#	src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
#	src/Umbraco.Web.Common/DependencyInjection/ServiceCollectionExtensions.cs
#	src/Umbraco.Web.Common/Middleware/BootFailedMiddleware.cs
#	src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
#	src/Umbraco.Web/Security/MembershipHelper.cs
#	src/Umbraco.Web/Security/MembershipProviderBase.cs
#	src/Umbraco.Web/Security/Providers/MembersMembershipProvider.cs
#	src/Umbraco.Web/Security/Providers/MembersRoleProvider.cs
#	src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs
This commit is contained in:
Emma Garland
2021-02-22 20:55:12 +00:00
3239 changed files with 12939 additions and 12167 deletions

View File

@@ -1,18 +1,22 @@
using System;
using System;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.Extensions.Options;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.Models;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Net;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
using Umbraco.Extensions;
using Umbraco.Infrastructure.Services.Implement;
using Umbraco.Net;
namespace Umbraco.Core.Compose
{
@@ -63,7 +67,7 @@ namespace Umbraco.Core.Compose
MemberService.Exported -= OnMemberExported;
}
public static IUser UnknownUser(GlobalSettings globalSettings) => new User(globalSettings) { Id = Constants.Security.UnknownUserId, Name = Constants.Security.UnknownUserName, Email = "" };
public static IUser UnknownUser(GlobalSettings globalSettings) => new User(globalSettings) { Id = Cms.Core.Constants.Security.UnknownUserId, Name = Cms.Core.Constants.Security.UnknownUserName, Email = "" };
private IUser CurrentPerformingUser
{

View File

@@ -1,4 +1,4 @@
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Core.Compose
{

View File

@@ -3,10 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.PropertyEditors;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Web.Compose
{

View File

@@ -1,4 +1,4 @@
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Web.Compose
{

View File

@@ -1,14 +1,15 @@
using System;
using System.Linq;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Core.PropertyEditors;
using Umbraco.Extensions;
using Umbraco.Web.PropertyEditors;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Web.Compose
{
/// <summary>
/// A component for NestedContent used to bind to events
/// </summary>

View File

@@ -1,5 +1,5 @@
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
using Umbraco.Core;
namespace Umbraco.Web.Compose
{

View File

@@ -1,20 +1,25 @@
using System;
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Cms.Core.Actions;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Hosting;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Entities;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Core.Services.Implement;
using Umbraco.Web.Actions;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Web.Compose
{
@@ -72,40 +77,40 @@ namespace Umbraco.Web.Compose
UserService.UserGroupPermissionsAssigned -= UserService_UserGroupPermissionsAssigned;
}
private void UserService_UserGroupPermissionsAssigned(IUserService sender, Core.Events.SaveEventArgs<EntityPermission> args)
private void UserService_UserGroupPermissionsAssigned(IUserService sender, SaveEventArgs<EntityPermission> args)
=> UserServiceUserGroupPermissionsAssigned(args, _contentService);
private void PublicAccessService_Saved(IPublicAccessService sender, Core.Events.SaveEventArgs<PublicAccessEntry> args)
private void PublicAccessService_Saved(IPublicAccessService sender, SaveEventArgs<PublicAccessEntry> args)
=> PublicAccessServiceSaved(args, _contentService);
private void ContentService_RolledBack(IContentService sender, Core.Events.RollbackEventArgs<IContent> args)
private void ContentService_RolledBack(IContentService sender, RollbackEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionRollback>(), args.Entity);
private void ContentService_Copied(IContentService sender, Core.Events.CopyEventArgs<IContent> args)
private void ContentService_Copied(IContentService sender, CopyEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionCopy>(), args.Original);
private void ContentService_Trashed(IContentService sender, Core.Events.MoveEventArgs<IContent> args)
private void ContentService_Trashed(IContentService sender, 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)
private void ContentService_Moved(IContentService sender, MoveEventArgs<IContent> args)
=> ContentServiceMoved(args);
private void ContentService_Unpublished(IContentService sender, Core.Events.PublishEventArgs<IContent> args)
private void ContentService_Unpublished(IContentService sender, PublishEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionUnpublish>(), args.PublishedEntities.ToArray());
private void ContentService_Saved(IContentService sender, Core.Events.ContentSavedEventArgs args)
private void ContentService_Saved(IContentService sender, ContentSavedEventArgs args)
=> ContentServiceSaved(args);
private void ContentService_Sorted(IContentService sender, Core.Events.SaveEventArgs<IContent> args)
private void ContentService_Sorted(IContentService sender, SaveEventArgs<IContent> args)
=> ContentServiceSorted(sender, args);
private void ContentService_Published(IContentService sender, Core.Events.ContentPublishedEventArgs args)
private void ContentService_Published(IContentService sender, ContentPublishedEventArgs args)
=> _notifier.Notify(_actions.GetAction<ActionPublish>(), args.PublishedEntities.ToArray());
private void ContentService_SentToPublish(IContentService sender, Core.Events.SendToPublishEventArgs<IContent> args)
private void ContentService_SentToPublish(IContentService sender, SendToPublishEventArgs<IContent> args)
=> _notifier.Notify(_actions.GetAction<ActionToPublish>(), args.Entity);
private void ContentServiceSorted(IContentService sender, Core.Events.SaveEventArgs<IContent> args)
private void ContentServiceSorted(IContentService sender, 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
@@ -120,7 +125,7 @@ namespace Umbraco.Web.Compose
_notifier.Notify(_actions.GetAction<ActionSort>(), new[] { parent });
}
private void ContentServiceSaved(Core.Events.SaveEventArgs<IContent> args)
private void ContentServiceSaved(SaveEventArgs<IContent> args)
{
var newEntities = new List<IContent>();
var updatedEntities = new List<IContent>();
@@ -144,7 +149,7 @@ namespace Umbraco.Web.Compose
_notifier.Notify(_actions.GetAction<ActionUpdate>(), updatedEntities.ToArray());
}
private void UserServiceUserGroupPermissionsAssigned(Core.Events.SaveEventArgs<EntityPermission> args, IContentService contentService)
private void UserServiceUserGroupPermissionsAssigned(SaveEventArgs<EntityPermission> args, IContentService contentService)
{
var entities = contentService.GetByIds(args.SavedEntities.Select(e => e.EntityId)).ToArray();
if (entities.Any() == false)
@@ -154,7 +159,7 @@ namespace Umbraco.Web.Compose
_notifier.Notify(_actions.GetAction<ActionRights>(), entities);
}
private void ContentServiceMoved(Core.Events.MoveEventArgs<IContent> args)
private void ContentServiceMoved(MoveEventArgs<IContent> args)
{
// notify about the move for all moved items
_notifier.Notify(_actions.GetAction<ActionMove>(), args.MoveInfoCollection.Select(m => m.Entity).ToArray());
@@ -170,7 +175,7 @@ namespace Umbraco.Web.Compose
}
}
private void PublicAccessServiceSaved(Core.Events.SaveEventArgs<PublicAccessEntry> args, IContentService contentService)
private void PublicAccessServiceSaved(SaveEventArgs<PublicAccessEntry> args, IContentService contentService)
{
var entities = contentService.GetByIds(args.SavedEntities.Select(e => e.ProtectedNodeId)).ToArray();
if (entities.Any() == false)

View File

@@ -1,5 +1,6 @@
using Umbraco.Core.DependencyInjection;
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Extensions;
namespace Umbraco.Web.Compose
{

View File

@@ -1,8 +1,10 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Services;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Core.Services.Implement;
using Umbraco.Extensions;
namespace Umbraco.Web.Compose
{
@@ -24,7 +26,7 @@ namespace Umbraco.Web.Compose
MemberGroupService.Saved -= MemberGroupService_Saved;
}
private void MemberGroupService_Saved(IMemberGroupService sender, Core.Events.SaveEventArgs<Core.Models.IMemberGroup> e)
private void MemberGroupService_Saved(IMemberGroupService sender, SaveEventArgs<IMemberGroup> e)
{
foreach (var grp in e.SavedEntities)
{

View File

@@ -1,4 +1,4 @@
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Web.Compose
{

View File

@@ -1,4 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
@@ -27,20 +30,20 @@ namespace Umbraco.Core.Compose
ContentService.Copied -= ContentServiceCopied;
}
private void ContentServiceCopied(IContentService sender, Events.CopyEventArgs<IContent> e)
private void ContentServiceCopied(IContentService sender, CopyEventArgs<IContent> e)
{
if (e.RelateToOriginal == false) return;
var relationType = _relationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias);
var relationType = _relationService.GetRelationTypeByAlias(Cms.Core.Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias);
if (relationType == null)
{
relationType = new RelationType(Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias,
Constants.Conventions.RelationTypes.RelateDocumentOnCopyName,
relationType = new RelationType(Cms.Core.Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias,
Cms.Core.Constants.Conventions.RelationTypes.RelateDocumentOnCopyName,
true,
Constants.ObjectTypes.Document,
Constants.ObjectTypes.Document);
Cms.Core.Constants.ObjectTypes.Document,
Cms.Core.Constants.ObjectTypes.Document);
_relationService.Save(relationType);
}

View File

@@ -1,4 +1,4 @@
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Core.Compose
{

View File

@@ -1,10 +1,11 @@
using System.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
using Umbraco.Extensions;
namespace Umbraco.Core.Compose
{
@@ -48,10 +49,10 @@ namespace Umbraco.Core.Compose
private void ContentService_Moved(IContentService sender, MoveEventArgs<IContent> e)
{
foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.System.RecycleBinContentString)))
foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Cms.Core.Constants.System.RecycleBinContentString)))
{
const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias;
const string relationTypeAlias = Cms.Core.Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias;
var relations = _relationService.GetByChildId(item.Entity.Id);
foreach (var relation in relations.Where(x => x.RelationType.Alias.InvariantEquals(relationTypeAlias)))
@@ -63,9 +64,9 @@ namespace Umbraco.Core.Compose
private void MediaService_Moved(IMediaService sender, MoveEventArgs<IMedia> e)
{
foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.System.RecycleBinMediaString)))
foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Cms.Core.Constants.System.RecycleBinMediaString)))
{
const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias;
const string relationTypeAlias = Cms.Core.Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias;
var relations = _relationService.GetByChildId(item.Entity.Id);
foreach (var relation in relations.Where(x => x.RelationType.Alias.InvariantEquals(relationTypeAlias)))
{
@@ -78,15 +79,15 @@ namespace Umbraco.Core.Compose
{
using (var scope = _scopeProvider.CreateScope())
{
const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias;
const string relationTypeAlias = Cms.Core.Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias;
var relationType = _relationService.GetRelationTypeByAlias(relationTypeAlias);
// check that the relation-type exists, if not, then recreate it
if (relationType == null)
{
var documentObjectType = Constants.ObjectTypes.Document;
var documentObjectType = Cms.Core.Constants.ObjectTypes.Document;
const string relationTypeName =
Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName;
Cms.Core.Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName;
relationType = new RelationType(relationTypeName, relationTypeAlias, false, documentObjectType,
documentObjectType);
@@ -98,7 +99,7 @@ namespace Umbraco.Core.Compose
var originalPath = item.OriginalPath.ToDelimitedList();
var originalParentId = originalPath.Count > 2
? int.Parse(originalPath[originalPath.Count - 2])
: Constants.System.Root;
: Cms.Core.Constants.System.Root;
//before we can create this relation, we need to ensure that the original parent still exists which
//may not be the case if the encompassing transaction also deleted it when this item was moved to the bin
@@ -129,14 +130,14 @@ namespace Umbraco.Core.Compose
using (var scope = _scopeProvider.CreateScope())
{
const string relationTypeAlias =
Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias;
Cms.Core.Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias;
var relationType = _relationService.GetRelationTypeByAlias(relationTypeAlias);
// check that the relation-type exists, if not, then recreate it
if (relationType == null)
{
var documentObjectType = Constants.ObjectTypes.Document;
var documentObjectType = Cms.Core.Constants.ObjectTypes.Document;
const string relationTypeName =
Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName;
Cms.Core.Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName;
relationType = new RelationType(relationTypeName, relationTypeAlias, false, documentObjectType,
documentObjectType);
_relationService.Save(relationType);
@@ -147,7 +148,7 @@ namespace Umbraco.Core.Compose
var originalPath = item.OriginalPath.ToDelimitedList();
var originalParentId = originalPath.Count > 2
? int.Parse(originalPath[originalPath.Count - 2])
: Constants.System.Root;
: Cms.Core.Constants.System.Root;
//before we can create this relation, we need to ensure that the original parent still exists which
//may not be the case if the encompassing transaction also deleted it when this item was moved to the bin
if (_entityService.Exists(originalParentId))

View File

@@ -1,4 +1,4 @@
using Umbraco.Core.Composing;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Core.Compose
{