private Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncsForFailedBindings() { Dictionary <Workload, List <ChangeNotificationData> > dictionary = new Dictionary <Workload, List <ChangeNotificationData> >(); using (IEnumerator <BindingStorage> enumerator = this.PsPolicyPresentationObject.StorageBindings.GetEnumerator()) { while (enumerator.MoveNext()) { BindingStorage bindingStorage = enumerator.Current; IEnumerable <UnifiedPolicySettingStatus> source = PolicySettingStatusHelpers.LoadSyncStatuses(base.DataSession, Utils.GetUniversalIdentity(bindingStorage), typeof(BindingStorage).Name); bool flag = false; if (source.Any((UnifiedPolicySettingStatus s) => SetCompliancePolicyBase.HasDistributionFailed(bindingStorage, s))) { flag = true; bindingStorage.PolicyVersion = CombGuidGenerator.NewGuid(); if (!dictionary.ContainsKey(bindingStorage.Workload)) { dictionary[bindingStorage.Workload] = new List <ChangeNotificationData>(); } dictionary[bindingStorage.Workload].Add(AggregatedNotificationClients.CreateChangeData(bindingStorage.Workload, bindingStorage)); } List <ChangeNotificationData> list = this.GenerateSyncsForFailedScopes(bindingStorage.AppliedScopes); list.AddRange(this.GenerateSyncsForFailedScopes(bindingStorage.RemovedScopes)); if (list.Any <ChangeNotificationData>()) { if (!dictionary.ContainsKey(bindingStorage.Workload)) { dictionary[bindingStorage.Workload] = new List <ChangeNotificationData>(); } dictionary[bindingStorage.Workload].AddRange(list); if (!flag) { flag = true; bindingStorage.PolicyVersion = CombGuidGenerator.NewGuid(); base.DataSession.Save(bindingStorage); dictionary[bindingStorage.Workload].Add(AggregatedNotificationClients.CreateChangeData(bindingStorage.Workload, bindingStorage)); } } if (flag) { base.DataSession.Save(bindingStorage); } } } return(dictionary); }
private static Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncs(IEnumerable <UnifiedPolicySettingStatus> syncStatuses, IEnumerable <Workload> workloads, IConfigDataProvider dataSession, UnifiedPolicyStorageBase storageObject, ConfigurationObjectType objectType) { Dictionary <Workload, List <ChangeNotificationData> > dictionary = new Dictionary <Workload, List <ChangeNotificationData> >(); if (syncStatuses.Any((UnifiedPolicySettingStatus s) => SetCompliancePolicyBase.HasDistributionFailed(storageObject, s))) { storageObject.PolicyVersion = CombGuidGenerator.NewGuid(); dataSession.Save(storageObject); foreach (Workload workload in workloads) { dictionary[workload] = new List <ChangeNotificationData> { AggregatedNotificationClients.CreateChangeData(workload, storageObject) }; } } return(dictionary); }
private List <ChangeNotificationData> GenerateSyncsForFailedScopes(IEnumerable <ScopeStorage> scopeStorages) { List <ChangeNotificationData> list = new List <ChangeNotificationData>(); foreach (ScopeStorage scopeStorage in scopeStorages) { IEnumerable <UnifiedPolicySettingStatus> enumerable = PolicySettingStatusHelpers.LoadSyncStatuses(base.DataSession, Utils.GetUniversalIdentity(scopeStorage), typeof(ScopeStorage).Name); foreach (UnifiedPolicySettingStatus status in enumerable) { if (SetCompliancePolicyBase.HasDistributionFailed(scopeStorage, status)) { scopeStorage.PolicyVersion = CombGuidGenerator.NewGuid(); list.Add(AggregatedNotificationClients.CreateChangeData(scopeStorage.Workload, scopeStorage)); } } } return(list); }
private void ValidateBindingParameterBeforeMerge() { if (this.AddExchangeBinding.Intersect(this.RemoveExchangeBinding, StringComparer.InvariantCultureIgnoreCase).Any <string>()) { throw new AddRemoveExBindingsOverlappedException(string.Join(",", this.AddExchangeBinding.Intersect(this.RemoveExchangeBinding, StringComparer.InvariantCultureIgnoreCase))); } if (this.AddSharePointBinding.Intersect(this.RemoveSharePointBinding, StringComparer.InvariantCultureIgnoreCase).Any <string>()) { throw new AddRemoveSpBindingsOverlappedException(string.Join(",", this.AddSharePointBinding.Intersect(this.RemoveSharePointBinding, StringComparer.InvariantCultureIgnoreCase))); } if (this.AddOneDriveBinding.Intersect(this.RemoveOneDriveBinding, StringComparer.InvariantCultureIgnoreCase).Any <string>()) { throw new AddRemoveSpBindingsOverlappedException(string.Join(",", this.AddOneDriveBinding.Intersect(this.RemoveOneDriveBinding, StringComparer.InvariantCultureIgnoreCase))); } this.InternalAddExchangeBindings = new MultiValuedProperty <BindingMetadata>(); this.InternalRemoveExchangeBindings = new MultiValuedProperty <BindingMetadata>(); this.InternalAddSharePointBindings = new MultiValuedProperty <BindingMetadata>(); this.InternalRemoveSharePointBindings = new MultiValuedProperty <BindingMetadata>(); this.InternalAddOneDriveBindings = new MultiValuedProperty <BindingMetadata>(); this.InternalRemoveOneDriveBindings = new MultiValuedProperty <BindingMetadata>(); if (this.RemoveExchangeBinding.Any <string>()) { this.ValidateRecipientsForRemove(); } if (this.AddExchangeBinding.Any <string>()) { List <string> list = (from b in this.PsPolicyPresentationObject.ExchangeBinding select b.ImmutableIdentity).ToList <string>(); list.AddRange(this.AddExchangeBinding); this.AddExchangeBinding = NewCompliancePolicyBase.ValidateWideScopeBinding(this.AddExchangeBinding, "All", "All", new BindingCannotCombineAllWithIndividualBindingsException("Exchange")); this.ExpandGroupsAndValidateRecipientsForAdd(); } this.InternalRemoveSharePointBindings = this.ValidateSharepointSitesForRemove(this.RemoveSharePointBinding); SetCompliancePolicyBase.ValidateAddedSharepointBinding(this.AddSharePointBinding, this.RemoveSharePointBinding, this.PsPolicyPresentationObject.SharePointBinding, "Sharepoint"); this.InternalAddSharePointBindings = this.ValidateSharepointSitesForAdd(this.PsPolicyPresentationObject.SharePointBinding, this.InternalRemoveSharePointBindings, this.AddSharePointBinding, Workload.SharePoint); this.InternalRemoveOneDriveBindings = this.ValidateSharepointSitesForRemove(this.RemoveOneDriveBinding); SetCompliancePolicyBase.ValidateAddedSharepointBinding(this.AddOneDriveBinding, this.RemoveOneDriveBinding, this.PsPolicyPresentationObject.OneDriveBinding, "OneDriveBusiness"); this.InternalAddOneDriveBindings = this.ValidateSharepointSitesForAdd(this.PsPolicyPresentationObject.OneDriveBinding, this.InternalRemoveOneDriveBindings, this.AddOneDriveBinding, Workload.OneDriveForBusiness); }
private Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncsForFailedRules(IEnumerable <Workload> workloads) { Dictionary <Workload, List <ChangeNotificationData> > dictionary = new Dictionary <Workload, List <ChangeNotificationData> >(); IList <RuleStorage> list = Utils.LoadRuleStoragesByPolicy(base.DataSession, this.DataObject, Utils.GetRootId(base.DataSession)); foreach (RuleStorage storageObject in list) { IEnumerable <UnifiedPolicySettingStatus> syncStatuses = PolicySettingStatusHelpers.LoadSyncStatuses(base.DataSession, Utils.GetUniversalIdentity(storageObject), typeof(RuleStorage).Name); Dictionary <Workload, List <ChangeNotificationData> > dictionary2 = SetCompliancePolicyBase.GenerateSyncs(syncStatuses, workloads, base.DataSession, storageObject, ConfigurationObjectType.Rule); foreach (Workload key in dictionary2.Keys) { if (dictionary.ContainsKey(key)) { dictionary[key].AddRange(dictionary2[key]); } else { dictionary[key] = dictionary2[key]; } } } return(dictionary); }
private Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncsForFailedPolicies(IEnumerable <Workload> workloads) { IEnumerable <UnifiedPolicySettingStatus> syncStatuses = PolicySettingStatusHelpers.LoadSyncStatuses(base.DataSession, Utils.GetUniversalIdentity(this.DataObject), typeof(PolicyStorage).Name); return(SetCompliancePolicyBase.GenerateSyncs(syncStatuses, workloads, base.DataSession, this.DataObject, ConfigurationObjectType.Policy)); }