using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; namespace Umbraco.Web.Models.ContentEditing { /// /// The user group permissions assigned to a content node /// /// /// The underlying data such as Name, etc... is that of the User Group /// [DataContract(Name = "userGroupPermissions", Namespace = "")] public class AssignedUserGroupPermissions : EntityBasic { /// /// The assigned permissions for the user group organized by permission group name /// [DataMember(Name = "permissions")] public IDictionary> AssignedPermissions { get; set; } /// /// The default permissions for the user group organized by permission group name /// [DataMember(Name = "defaultPermissions")] public IDictionary> DefaultPermissions { get; set; } public static IDictionary> ClonePermissions(IDictionary> permissions) { var result = new Dictionary>(); foreach (var permission in permissions) { result[permission.Key] = new List(permission.Value.Select(x => (Permission)x.Clone())); } return result; } } }