Use standard Member property group name/alias

This commit is contained in:
Ronald Barendse
2021-11-03 16:46:56 +01:00
parent bb323b0286
commit 0f5f7d24e5
6 changed files with 17 additions and 10 deletions

View File

@@ -242,9 +242,14 @@ namespace Umbraco.Core
public const string FailedPasswordAttemptsLabel = "Failed Password Attempts";
/// <summary>
/// Group name to put the membership properties on
/// The standard properties group alias for membership properties.
/// </summary>
internal const string StandardPropertiesGroupName = "Membership";
public const string StandardPropertiesGroupAlias = "membership";
/// <summary>
/// The standard properties group name for membership properties.
/// </summary>
public const string StandardPropertiesGroupName = "Membership";
public static Dictionary<string, PropertyType> GetStandardPropertyTypeStubs()
{

View File

@@ -230,7 +230,7 @@ namespace Umbraco.Core.Migrations.Install
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 54, UniqueId = new Guid(Constants.PropertyTypeGroups.Article), ContentTypeNodeId = 1036, Text = "Article", Alias = "article", SortOrder = 1 });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 55, UniqueId = new Guid(Constants.PropertyTypeGroups.VectorGraphics), ContentTypeNodeId = 1037, Text = "Vector Graphics", Alias = "vectorGraphics", SortOrder = 1 });
//membership property group
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership), ContentTypeNodeId = 1044, Text = "Membership", Alias = "membership", SortOrder = 1 });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership), ContentTypeNodeId = 1044, Text = Constants.Conventions.Member.StandardPropertiesGroupName, Alias = Constants.Conventions.Member.StandardPropertiesGroupAlias, SortOrder = 1 });
}
private void CreatePropertyTypeData()

View File

@@ -250,12 +250,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (contentType is MemberType memberType)
{
// ensure that the group exists (ok if it already exists)
memberType.AddPropertyGroup(Constants.Conventions.Member.StandardPropertiesGroupName);
memberType.AddPropertyGroup(Constants.Conventions.Member.StandardPropertiesGroupAlias, Constants.Conventions.Member.StandardPropertiesGroupName);
// ensure that property types exist (ok if they already exist)
foreach (var (alias, propertyType) in builtinProperties)
{
var added = memberType.AddPropertyType(propertyType, Constants.Conventions.Member.StandardPropertiesGroupName);
var added = memberType.AddPropertyType(propertyType, Constants.Conventions.Member.StandardPropertiesGroupAlias, Constants.Conventions.Member.StandardPropertiesGroupName);
if (added)
{

View File

@@ -142,11 +142,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
//By Convention we add 9 standard PropertyTypes to an Umbraco MemberType
entity.AddPropertyGroup(Constants.Conventions.Member.StandardPropertiesGroupName);
entity.AddPropertyGroup(Constants.Conventions.Member.StandardPropertiesGroupAlias, Constants.Conventions.Member.StandardPropertiesGroupName);
var standardPropertyTypes = Constants.Conventions.Member.GetStandardPropertyTypeStubs();
foreach (var standardPropertyType in standardPropertyTypes)
{
entity.AddPropertyType(standardPropertyType.Value, Constants.Conventions.Member.StandardPropertiesGroupName);
entity.AddPropertyType(standardPropertyType.Value, Constants.Conventions.Member.StandardPropertiesGroupAlias, Constants.Conventions.Member.StandardPropertiesGroupName);
}
EnsureExplicitDataTypeForBuiltInProperties(entity);

View File

@@ -1201,8 +1201,10 @@ namespace Umbraco.Core.Services.Implement
var memType = new MemberType(-1);
var propGroup = new PropertyGroup(MemberType.SupportsPublishingConst)
{
Name = "Membership",
Id = --identity
Alias = Constants.Conventions.Member.StandardPropertiesGroupAlias,
Name = Constants.Conventions.Member.StandardPropertiesGroupName,
Id = --identity,
Key = identity.ToGuid()
};
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, Constants.Conventions.Member.Comments)
{

View File

@@ -326,7 +326,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.AreEqual(3, memberType.PropertyTypes.Count());
// add one stub property, others are still missing
memberType.AddPropertyType(stubs.First().Value, Constants.Conventions.Member.StandardPropertiesGroupName);
memberType.AddPropertyType(stubs.First().Value, Constants.Conventions.Member.StandardPropertiesGroupAlias, Constants.Conventions.Member.StandardPropertiesGroupName);
// saving *new* member type adds the (missing) stub properties
repository.Save(memberType);