Fix user for v7 migration
This commit is contained in:
@@ -54,7 +54,6 @@ namespace Umbraco.Core.Models.Membership
|
||||
_isLockedOut = false;
|
||||
_startContentIds = new int[] { };
|
||||
_startMediaIds = new int[] { };
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -36,6 +36,13 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
user.InvitedDate = dto.InvitedDate;
|
||||
user.TourData = dto.TourData;
|
||||
|
||||
// we should never get user with ID zero from database, except
|
||||
// when upgrading from v7 - mark that user so that we do not
|
||||
// save it back to database (as that would create a *new* user)
|
||||
// see also: UserRepository.PersistNewItem
|
||||
if (dto.Id == 0)
|
||||
user.AdditionalData["IS_V7_ZERO"] = true;
|
||||
|
||||
// reset dirty initial properties (U4-1946)
|
||||
user.ResetDirtyProperties(false);
|
||||
|
||||
|
||||
@@ -434,6 +434,17 @@ ORDER BY colName";
|
||||
|
||||
protected override void PersistNewItem(IUser entity)
|
||||
{
|
||||
// the use may have no identity, ie ID is zero, and be v7 super
|
||||
// user - then it has been marked - and we must not persist it
|
||||
// as new, as we do not want to create a new user - instead, persist
|
||||
// it as updated
|
||||
// see also: UserFactory.BuildEntity
|
||||
if (((User) entity).AdditionalData.ContainsKey("IS_V7_ZERO"))
|
||||
{
|
||||
PersistUpdatedItem(entity);
|
||||
return;
|
||||
}
|
||||
|
||||
((User) entity).AddingEntity();
|
||||
|
||||
// ensure security stamp if missing
|
||||
|
||||
Reference in New Issue
Block a user