Lots of work on the member editor - creates new email address prop editor, allows text prop editor to be required based on config, fixes the section directive bug, creating change password prop ed, streamlines more of the services layer to ensure that the things that need to be public are public
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Mapping;
|
||||
@@ -53,7 +54,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
config.CreateMap<IMember, ContentItemDto<IMember>>()
|
||||
.ForMember(
|
||||
dto => dto.Owner,
|
||||
expression => expression.ResolveUsing<OwnerResolver<IMember>>());
|
||||
expression => expression.ResolveUsing<OwnerResolver<IMember>>())
|
||||
//do no map the custom member properties (currently anyways, they were never there in 6.x)
|
||||
.ForMember(dto => dto.Properties, expression => expression.ResolveUsing<MemberDtoPropertiesValueResolver>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +73,8 @@ namespace Umbraco.Web.Models.Mapping
|
||||
Alias = string.Format("{0}login", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
|
||||
Label = ui.Text("login"),
|
||||
Value = display.Username,
|
||||
View = "textbox"
|
||||
View = "textbox",
|
||||
Config = new Dictionary<string, object> { { "IsRequired", true } }
|
||||
},
|
||||
new ContentPropertyDisplay
|
||||
{
|
||||
@@ -84,10 +88,28 @@ namespace Umbraco.Web.Models.Mapping
|
||||
Alias = string.Format("{0}email", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
|
||||
Label = ui.Text("general", "email"),
|
||||
Value = display.Email,
|
||||
View = "textbox"
|
||||
View = "email",
|
||||
Config = new Dictionary<string, object> {{"IsRequired", true}}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This ensures that the custom membership provider properties are not mapped (currently since they weren't there in v6)
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Because these properties don't exist on the form, if we don't remove them for this map we'll get validation errors when posting data
|
||||
/// </remarks>
|
||||
internal class MemberDtoPropertiesValueResolver : ValueResolver<IMember, IEnumerable<ContentPropertyDto>>
|
||||
{
|
||||
protected override IEnumerable<ContentPropertyDto> ResolveCore(IMember source)
|
||||
{
|
||||
var exclude = Constants.Conventions.Member.StandardPropertyTypeStubs.Select(x => x.Value.Alias).ToArray();
|
||||
return source.Properties
|
||||
.Where(x => exclude.Contains(x.Alias) == false)
|
||||
.Select(Mapper.Map<Property, ContentPropertyDto>);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user