fixes tests for mappings
This commit is contained in:
@@ -77,7 +77,7 @@ namespace Umbraco.Web.Editors
|
||||
Id = startId,
|
||||
//UserType = "writer",
|
||||
AllowedSections = new[] {"content", "media"},
|
||||
AvailableUserTypes = userTypes,
|
||||
AvailableUserGroups = userTypes,
|
||||
Email = "test" + startId + "@test.com",
|
||||
Name = "User " + startId,
|
||||
Culture = "en-US",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -20,23 +21,27 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
[DataMember(Name = "email", IsRequired = true)]
|
||||
public string Email { get; set; }
|
||||
|
||||
//TODO: Should be user groups!
|
||||
//[DataMember(Name = "userType")]
|
||||
//public string UserType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of group aliases assigned to the user
|
||||
/// </summary>
|
||||
[DataMember(Name = "userGroups")]
|
||||
public IEnumerable<string> UserGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available user types (i.e. to populate a drop down)
|
||||
/// The key is the Alias the value is the Name - the Alias is what is used in the UserType property and for persistence
|
||||
/// Gets the available user groups (i.e. to populate a drop down)
|
||||
/// The key is the Alias the value is the Name - the Alias is what is used in the UserGroup property and for persistence
|
||||
/// </summary>
|
||||
[DataMember(Name = "availableUserTypes")]
|
||||
public IDictionary<string, string> AvailableUserTypes { get; set; }
|
||||
[DataMember(Name = "availableUserGroups")]
|
||||
[ReadOnly(true)]
|
||||
public IDictionary<string, string> AvailableUserGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available cultures (i.e. to populate a drop down)
|
||||
/// The key is the culture stored in the database, the value is the Name
|
||||
/// </summary>
|
||||
[DataMember(Name = "availableCultures")]
|
||||
[ReadOnly(true)]
|
||||
public IDictionary<string, string> AvailableCultures { get; set; }
|
||||
|
||||
[DataMember(Name = "startContentId")]
|
||||
@@ -51,6 +56,14 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[DataMember(Name = "allowedSections")]
|
||||
public IEnumerable<string> AllowedSections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available sections (i.e. to populate a drop down)
|
||||
/// The key is the Alias the value is the Name - the Alias is what is used in the AllowedSections property and for persistence
|
||||
/// </summary>
|
||||
[DataMember(Name = "availableSections")]
|
||||
[ReadOnly(true)]
|
||||
public IDictionary<string, string> AvailableSections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
|
||||
/// </summary>
|
||||
|
||||
@@ -18,13 +18,28 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
config.CreateMap<IUser, UserDisplay>()
|
||||
.ForMember(detail => detail.Id, opt => opt.MapFrom(user => user.Id))
|
||||
//.ForMember(detail => detail.UserType, opt => opt.MapFrom(user => user.UserType.Alias))
|
||||
.ForMember(detail => detail.UserGroups, opt => opt.MapFrom(user => user.Groups))
|
||||
.ForMember(detail => detail.StartContentId, opt => opt.MapFrom(user => user.StartContentId))
|
||||
.ForMember(detail => detail.StartMediaId, opt => opt.MapFrom(user => user.StartMediaId))
|
||||
.ForMember(detail => detail.Culture, opt => opt.MapFrom(user => user.GetUserCulture(applicationContext.Services.TextService)))
|
||||
.ForMember(
|
||||
detail => detail.AvailableUserTypes,
|
||||
opt => opt.MapFrom(user => applicationContext.Services.SectionService.GetSections().ToDictionary(x => x.Alias, x => x.Name)));
|
||||
detail => detail.AvailableUserGroups,
|
||||
opt => opt.MapFrom(user => applicationContext.Services.UserService.GetAllUserGroups().ToDictionary(x => x.Alias, x => x.Name)))
|
||||
.ForMember(
|
||||
detail => detail.AvailableSections,
|
||||
opt => opt.MapFrom(user => applicationContext.Services.SectionService.GetSections().ToDictionary(x => x.Alias, x => x.Name)))
|
||||
.ForMember(
|
||||
detail => detail.AvailableCultures,
|
||||
opt => opt.MapFrom(user => applicationContext.Services.TextService.GetSupportedCultures().ToDictionary(x => x.Name, x => x.DisplayName)))
|
||||
.ForMember(detail => detail.ParentId, opt => opt.UseValue(-1))
|
||||
.ForMember(detail => detail.Path, opt => opt.MapFrom(user => "-1," + user.Id))
|
||||
.ForMember(detail => detail.Notifications, opt => opt.Ignore())
|
||||
.ForMember(detail => detail.Udi, opt => opt.Ignore())
|
||||
.ForMember(detail => detail.Icon, opt => opt.Ignore())
|
||||
.ForMember(detail => detail.Trashed, opt => opt.Ignore())
|
||||
.ForMember(detail => detail.Alias, opt => opt.Ignore())
|
||||
.ForMember(detail => detail.Trashed, opt => opt.Ignore())
|
||||
.ForMember(detail => detail.AdditionalData, opt => opt.Ignore());
|
||||
|
||||
config.CreateMap<IUser, UserDetail>()
|
||||
.ForMember(detail => detail.UserId, opt => opt.MapFrom(user => GetIntId(user.Id)))
|
||||
|
||||
Reference in New Issue
Block a user