Move member properties to Member Content App (V9 merge regression) (#11768)

* Fix regression after merging to v9

* Update test to align with removed member properties
This commit is contained in:
Ronald Barendse
2021-12-20 08:45:11 +01:00
committed by Mole
parent 65c0d8fcec
commit 763cb70e67
2 changed files with 9 additions and 39 deletions

View File

@@ -65,14 +65,11 @@ namespace Umbraco.Cms.Core.Models.Mapping
var resolved = base.Map(source, context);
// This is kind of a hack because a developer is supposed to be allowed to set their property editor - would have been much easier
// if we just had all of the membership provider fields on the member table :(
// TODO: But is there a way to map the IMember.IsLockedOut to the property ? i dunno.
// IMember.IsLockedOut can't be set to true, so make it readonly when that's the case (you can only unlock)
var isLockedOutProperty = resolved.SelectMany(x => x.Properties).FirstOrDefault(x => x.Alias == Constants.Conventions.Member.IsLockedOut);
if (isLockedOutProperty?.Value != null && isLockedOutProperty.Value.ToString() != "1")
{
isLockedOutProperty.View = "readonlyvalue";
isLockedOutProperty.Value = _localizedTextService.Localize("general", "no");
isLockedOutProperty.Readonly = true;
}
return resolved;
@@ -191,20 +188,6 @@ namespace Umbraco.Cms.Core.Models.Mapping
{
var properties = new List<ContentPropertyDisplay>
{
new ContentPropertyDisplay
{
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}id",
Label = _localizedTextService.Localize("general","id"),
Value = new List<string> {member.Id.ToString(), member.Key.ToString()},
View = "idwithguid"
},
new ContentPropertyDisplay
{
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}doctype",
Label = _localizedTextService.Localize("content","membertype"),
Value = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, member.ContentType.Name),
View = _propertyEditorCollection[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View
},
GetLoginProperty(member, _localizedTextService),
new ContentPropertyDisplay
{
@@ -212,7 +195,7 @@ namespace Umbraco.Cms.Core.Models.Mapping
Label = _localizedTextService.Localize("general","email"),
Value = member.Email,
View = "email",
Validation = {Mandatory = true}
Validation = { Mandatory = true }
},
new ContentPropertyDisplay
{
@@ -221,12 +204,10 @@ namespace Umbraco.Cms.Core.Models.Mapping
Value = new Dictionary<string, object>
{
// TODO: why ignoreCase, what are we doing here?!
{"newPassword", member.GetAdditionalDataValueIgnoreCase("NewPassword", null)},
{ "newPassword", member.GetAdditionalDataValueIgnoreCase("NewPassword", null) }
},
// TODO: Hard coding this because the changepassword doesn't necessarily need to be a resolvable (real) property editor
View = "changepassword",
// Initialize the dictionary with the configuration from the default membership provider
Config = GetPasswordConfig(member)
Config = GetPasswordConfig(member) // Initialize the dictionary with the configuration from the default membership provider
},
new ContentPropertyDisplay
{
@@ -234,7 +215,10 @@ namespace Umbraco.Cms.Core.Models.Mapping
Label = _localizedTextService.Localize("content","membergroup"),
Value = GetMemberGroupValue(member.Username),
View = "membergroups",
Config = new Dictionary<string, object> {{"IsRequired", true}}
Config = new Dictionary<string, object>
{
{ "IsRequired", true }
}
}
};

View File

@@ -618,20 +618,6 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.BackOffice.Controllers
Id = 77,
Properties = new List<ContentPropertyDisplay>()
{
new ContentPropertyDisplay()
{
Alias = "_umb_id",
View = "idwithguid",
Value = new []
{
"123",
"guid"
}
},
new ContentPropertyDisplay()
{
Alias = "_umb_doctype"
},
new ContentPropertyDisplay()
{
Alias = "_umb_login"