Add member "kind" - and refactor user "type" to "kind" for consistency (#16979)

* Rename UserType to UserKind

* Add MemberKind to tell API members from regular ones

* Remove user kind from invite user endpoint

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
This commit is contained in:
Kenn Jacobsen
2024-09-03 10:43:09 +02:00
committed by GitHub
parent 2a6b376f0d
commit 874055eeab
28 changed files with 129 additions and 73 deletions

View File

@@ -21,7 +21,7 @@ public class BackOfficeIdentityUser : UmbracoIdentityUser
private DateTime? _inviteDateUtc;
private int[] _startContentIds;
private int[] _startMediaIds;
private UserType _type;
private UserKind _kind;
/// <summary>
/// Initializes a new instance of the <see cref="BackOfficeIdentityUser" /> class.
@@ -116,10 +116,10 @@ public class BackOfficeIdentityUser : UmbracoIdentityUser
}
}
public UserType Type
public UserKind Kind
{
get => _type;
set => BeingDirty.SetPropertyValueAndDetectChanges(value, ref _type, nameof(Type));
get => _kind;
set => BeingDirty.SetPropertyValueAndDetectChanges(value, ref _kind, nameof(Kind));
}
/// <summary>
@@ -130,7 +130,7 @@ public class BackOfficeIdentityUser : UmbracoIdentityUser
/// <param name="email">This is allowed to be null (but would need to be filled in if trying to persist this instance)</param>
/// <param name="culture"></param>
/// <param name="name"></param>
public static BackOfficeIdentityUser CreateNew(GlobalSettings globalSettings, string? username, string email, string culture, string? name = null, Guid? id = null, UserType type = UserType.Default)
public static BackOfficeIdentityUser CreateNew(GlobalSettings globalSettings, string? username, string email, string culture, string? name = null, Guid? id = null, UserKind kind = UserKind.Default)
{
if (string.IsNullOrWhiteSpace(username))
{
@@ -156,7 +156,7 @@ public class BackOfficeIdentityUser : UmbracoIdentityUser
user.HasIdentity = false;
user._culture = culture;
user.Name = name;
user.Type = type;
user.Kind = kind;
user.EnableChangeTracking();
return user;
}

View File

@@ -141,7 +141,7 @@ public class BackOfficeUserStore :
StartMediaIds = user.StartMediaIds ?? new int[] { },
IsLockedOut = user.IsLockedOut,
Key = user.Key,
Type = user.Type
Kind = user.Kind
};

View File

@@ -96,7 +96,7 @@ public class IdentityMapDefinition : IMapDefinition
target.SecurityStamp = source.SecurityStamp;
DateTime? lockedOutUntil = source.LastLockoutDate?.AddMinutes(_securitySettings.UserDefaultLockoutTimeInMinutes);
target.LockoutEnd = source.IsLockedOut ? (lockedOutUntil ?? DateTime.MaxValue).ToUniversalTime() : null;
target.Type = source.Type;
target.Kind = source.Kind;
}
// Umbraco.Code.MapAll -Id -LockoutEnabled -PhoneNumber -PhoneNumberConfirmed -ConcurrencyStamp -NormalizedEmail -NormalizedUserName -Roles