maps name and icon for user groups

This commit is contained in:
Shannon
2017-06-06 00:13:46 +02:00
parent 64975166e7
commit 76032cf5f7
4 changed files with 10 additions and 3 deletions

View File

@@ -7,6 +7,8 @@ namespace Umbraco.Core.Models.Membership
/// </summary>
public interface IReadOnlyUserGroup
{
string Name { get; }
string Icon { get; }
int Id { get; }
int StartContentId { get; }
int StartMediaId { get; }

View File

@@ -5,8 +5,10 @@ namespace Umbraco.Core.Models.Membership
{
public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGroup>
{
public ReadOnlyUserGroup(int id, int startContentId, int startMediaId, string @alias, IEnumerable<string> allowedSections)
public ReadOnlyUserGroup(int id, string name, string icon, int startContentId, int startMediaId, string @alias, IEnumerable<string> allowedSections)
{
Name = name;
Icon = icon;
Id = id;
StartContentId = startContentId;
StartMediaId = startMediaId;
@@ -15,6 +17,8 @@ namespace Umbraco.Core.Models.Membership
}
public int Id { get; private set; }
public string Name { get; private set; }
public string Icon { get; private set; }
public int StartContentId { get; private set; }
public int StartMediaId { get; private set; }
public string Alias { get; private set; }

View File

@@ -7,12 +7,12 @@ namespace Umbraco.Core.Models.Membership
{
public static IReadOnlyUserGroup ToReadOnlyGroup(this IUserGroup group)
{
return new ReadOnlyUserGroup(group.Id, group.StartContentId, group.StartMediaId, group.Alias, group.AllowedSections);
return new ReadOnlyUserGroup(group.Id, group.Name, group.Icon, group.StartContentId, group.StartMediaId, group.Alias, group.AllowedSections);
}
public static IReadOnlyUserGroup ToReadOnlyGroup(this UserGroupDto group)
{
return new ReadOnlyUserGroup(group.Id, group.StartContentId, group.StartMediaId, group.Alias, group.UserGroup2AppDtos.Select(x => x.AppAlias).ToArray());
return new ReadOnlyUserGroup(group.Id, group.Name, group.Icon, group.StartContentId, group.StartMediaId, group.Alias, group.UserGroup2AppDtos.Select(x => x.AppAlias).ToArray());
}
}
}

View File

@@ -89,6 +89,7 @@ namespace Umbraco.Web.Models.Mapping
config.CreateMap<IReadOnlyUserGroup, UserGroupDisplay>()
.ForMember(detail => detail.StartContentId, opt => opt.Ignore())
.ForMember(detail => detail.StartMediaId, opt => opt.Ignore())
.ForMember(detail => detail.Key, opt => opt.Ignore())
.ForMember(detail => detail.Sections, opt => opt.Ignore())
.ForMember(detail => detail.Notifications, opt => opt.Ignore())
.ForMember(detail => detail.Udi, opt => opt.Ignore())