public static ssa.SecureObject ToSecureObject(this legacySplxApi.UIElement uie) { ssa.SecureObject secureObject = new ssa.SecureObject { UId = uie.Id, UniqueName = uie.UniqueName, IsEnabled = true, //prop doesn't exist in legacy objects ParentUId = uie.ParentId }; secureObject.Security.DaclAllowInherit = uie.SecurityDescriptor.DaclInherit; secureObject.Security.SaclAllowInherit = uie.SecurityDescriptor.SaclInherit; secureObject.Security.SaclAuditTypeFilter = (ssa.AuditType)Enum.Parse(typeof(ssa.AuditType), uie.SecurityDescriptor.SaclAuditTypeFilter.ToString()); foreach (legacySplxApi.AccessControlEntryBase legacyAce in uie.SecurityDescriptor.Dacl) { secureObject.Security.Dacl.Add(legacyAce.ToNewAce()); } foreach (legacySplxApi.AccessControlEntryBase legacyAce in uie.SecurityDescriptor.Sacl) { secureObject.Security.Sacl.Add((ssa.IAccessControlEntryAudit)legacyAce.ToNewAce()); } return(secureObject); }
public static void ShallowCloneTo(this IList <SecureObject> source, IList <SecureObject> destination) { foreach (SecureObject item in source) { SecureObject clone = item.Clone(); destination.Add(clone); if (item.Children != null && item.Children.Count > 0) { item.Children.ShallowCloneTo(clone.Children); } } }
static void RecurseSecureObjectsForImport(IEnumerable <legacySplxApi.UIElement> uiElements, IList <ssa.SecureObject> secureObjects) { foreach (legacySplxApi.UIElement uie in uiElements) { ssa.SecureObject secureObject = uie.ToSecureObject(); secureObjects.Add(secureObject); IEnumerable <legacySplxApi.UIElement> children = GetUIElementCollection(uie.ChildObjects); if (children != null) { RecurseSecureObjectsForImport(children, secureObject.Children); } } }
public static void ChangeParent(this SecureObject source, SecureObject target, IList <SecureObject> storeList) { if (source.Parent != null) { source.Parent.Children.Remove(source); } else { storeList.Remove(source); } if (target != null) { source.Parent = target; source.ParentUId = target.UId; target.Children.Add(source); } else { source.Parent = null; source.ParentUId = null; storeList.Add(source); } }