Ejemplo n.º 1
0
        public static MultiValuedProperty <ADObjectId> GetDagServers(object dagList, object dagIdentity)
        {
            if (dagList == null)
            {
                throw new ArgumentNullException("dagList");
            }
            if (!(dagList is IList))
            {
                throw new ArgumentException("dagList");
            }
            if (dagIdentity == null)
            {
                throw new ArgumentNullException("dagIdentity");
            }
            MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();

            foreach (object obj in ((IList)dagList))
            {
                DatabaseAvailabilityGroup databaseAvailabilityGroup = (DatabaseAvailabilityGroup)obj;
                if (databaseAvailabilityGroup != null && databaseAvailabilityGroup.Identity.Equals(dagIdentity))
                {
                    using (MultiValuedProperty <ADObjectId> .Enumerator enumerator2 = databaseAvailabilityGroup.Servers.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            ADObjectId item = enumerator2.Current;
                            multiValuedProperty.Add(item);
                        }
                        break;
                    }
                }
            }
            multiValuedProperty.ResetChangeTracking();
            return(multiValuedProperty);
        }
Ejemplo n.º 2
0
        // Token: 0x060019C4 RID: 6596 RVA: 0x0006CB4C File Offset: 0x0006AD4C
        internal static object ManagedByGetter(IPropertyBag propertyBag)
        {
            object result;

            try
            {
                ADObjectId adobjectId = propertyBag[ADGroupSchema.RawManagedBy] as ADObjectId;
                MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();
                if (adobjectId != null)
                {
                    multiValuedProperty.Add(adobjectId);
                }
                MultiValuedProperty <ADObjectId> multiValuedProperty2 = propertyBag[ADGroupSchema.CoManagedBy] as MultiValuedProperty <ADObjectId>;
                foreach (ADObjectId item in multiValuedProperty2)
                {
                    if (!multiValuedProperty.Contains(item))
                    {
                        multiValuedProperty.Add(item);
                    }
                }
                multiValuedProperty.ResetChangeTracking();
                result = multiValuedProperty;
            }
            catch (InvalidOperationException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("ManagedBy", ex.Message), ADGroupSchema.ManagedBy, propertyBag[ADGroupSchema.RawManagedBy]), ex);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static IList GetFederationCertificateDomainName()
        {
            MultiValuedProperty <SmtpDomainWithSubdomains> multiValuedProperty = new MultiValuedProperty <SmtpDomainWithSubdomains>();

            multiValuedProperty.Add(new SmtpDomainWithSubdomains("Federation", false));
            multiValuedProperty.ResetChangeTracking();
            return(multiValuedProperty);
        }
Ejemplo n.º 4
0
        internal void UpdateRawMapiAttributes(bool movingToPreE14Server)
        {
            MultiValuedProperty <OfflineAddressBookMapiProperty> multiValuedProperty  = (MultiValuedProperty <OfflineAddressBookMapiProperty>) this.propertyBag[OfflineAddressBookSchema.ConfiguredAttributes];
            MultiValuedProperty <OfflineAddressBookMapiProperty> multiValuedProperty2 = new MultiValuedProperty <OfflineAddressBookMapiProperty>();

            foreach (OfflineAddressBookMapiProperty offlineAddressBookMapiProperty in multiValuedProperty)
            {
                offlineAddressBookMapiProperty.ResolveMapiPropTag();
                if (multiValuedProperty2.Contains(offlineAddressBookMapiProperty))
                {
                    throw new ArgumentException(DirectoryStrings.ErrorDuplicateMapiIdsInConfiguredAttributes);
                }
                multiValuedProperty2.Add(offlineAddressBookMapiProperty);
            }
            MultiValuedProperty <int> multiValuedProperty3 = new MultiValuedProperty <int>();
            MultiValuedProperty <int> multiValuedProperty4 = new MultiValuedProperty <int>();
            MultiValuedProperty <int> multiValuedProperty5 = new MultiValuedProperty <int>();

            foreach (OfflineAddressBookMapiProperty offlineAddressBookMapiProperty2 in multiValuedProperty2)
            {
                switch (offlineAddressBookMapiProperty2.Type)
                {
                case OfflineAddressBookMapiPropertyOption.ANR:
                    multiValuedProperty3.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;

                case OfflineAddressBookMapiPropertyOption.Value:
                    multiValuedProperty4.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;

                case OfflineAddressBookMapiPropertyOption.Indicator:
                    multiValuedProperty5.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;
                }
            }
            if (multiValuedProperty3.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty3.Add(0);
            }
            if (multiValuedProperty4.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty4.Add(0);
            }
            if (multiValuedProperty5.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty5.Add(0);
            }
            this.propertyBag[OfflineAddressBookSchema.ANRProperties]       = multiValuedProperty3;
            this.propertyBag[OfflineAddressBookSchema.DetailsProperties]   = multiValuedProperty4;
            this.propertyBag[OfflineAddressBookSchema.TruncatedProperties] = multiValuedProperty5;
            if (multiValuedProperty.IsReadOnly)
            {
                this.propertyBag.SetField(OfflineAddressBookSchema.ConfiguredAttributes, new MultiValuedProperty <OfflineAddressBookMapiProperty>());
                return;
            }
            multiValuedProperty.Clear();
            multiValuedProperty.ResetChangeTracking();
        }
Ejemplo n.º 5
0
        public static MultiValuedProperty <FederatedDomain> GenerateMvpFederatedDomains(object fedDomains)
        {
            MultiValuedProperty <FederatedDomain> multiValuedProperty = new MultiValuedProperty <FederatedDomain>();

            if (!fedDomains.IsNullValue())
            {
                foreach (object obj in ((IList)fedDomains))
                {
                    FederatedDomain item = (FederatedDomain)obj;
                    multiValuedProperty.Add(item);
                }
            }
            multiValuedProperty.ResetChangeTracking();
            return(multiValuedProperty);
        }
Ejemplo n.º 6
0
        internal static MultiValuedProperty <BindingMetadata> GetScopesFromStorage(BindingStorage bindingStorage)
        {
            ArgumentValidator.ThrowIfNull("bindingStorage", bindingStorage);
            MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>();

            if (bindingStorage.AppliedScopes.Any <ScopeStorage>())
            {
                foreach (ScopeStorage scopeStorage in bindingStorage.AppliedScopes)
                {
                    if (scopeStorage.Mode == Mode.Enforce)
                    {
                        multiValuedProperty.TryAdd(BindingMetadata.FromStorage(scopeStorage.Scope));
                    }
                }
            }
            multiValuedProperty.ResetChangeTracking();
            return(multiValuedProperty);
        }
Ejemplo n.º 7
0
 public override void Run(object interactionHandler, DataRow row, DataObjectStore store)
 {
     this.dataHandler.ProgressReport += base.OnProgressReport;
     try
     {
         this.dataHandler.Save(interactionHandler as CommandInteractionHandler);
         if (this.dataHandler.HasWorkUnits && !this.dataHandler.WorkUnits.HasFailures)
         {
             MultiValuedProperty <ADObjectId> multiValuedProperty = row["Members"] as MultiValuedProperty <ADObjectId>;
             if (multiValuedProperty != null)
             {
                 multiValuedProperty.ResetChangeTracking();
             }
         }
     }
     finally
     {
         this.dataHandler.ProgressReport -= base.OnProgressReport;
     }
 }
Ejemplo n.º 8
0
 internal static void PopulateScopeStorages(BindingStorage bindingStorage, MultiValuedProperty <BindingMetadata> scopes)
 {
     ArgumentValidator.ThrowIfNull("bindingStorage", bindingStorage);
     ArgumentValidator.ThrowIfNull("scopes", scopes);
     if (scopes.Changed)
     {
         object[] removed = scopes.Removed;
         for (int i = 0; i < removed.Length; i++)
         {
             BindingMetadata removedScope = (BindingMetadata)removed[i];
             ScopeStorage    scopeStorage = bindingStorage.AppliedScopes.Find((ScopeStorage item) => string.Equals(BindingMetadata.FromStorage(item.Scope).ImmutableIdentity, removedScope.ImmutableIdentity, StringComparison.OrdinalIgnoreCase));
             scopeStorage.Mode          = Mode.PendingDeletion;
             scopeStorage.PolicyVersion = CombGuidGenerator.NewGuid();
         }
         object[] added = scopes.Added;
         for (int j = 0; j < added.Length; j++)
         {
             BindingMetadata addedScope    = (BindingMetadata)added[j];
             ScopeStorage    scopeStorage2 = bindingStorage.AppliedScopes.Find((ScopeStorage item) => string.Equals(BindingMetadata.FromStorage(item.Scope).ImmutableIdentity, addedScope.ImmutableIdentity, StringComparison.OrdinalIgnoreCase));
             if (scopeStorage2 == null)
             {
                 Guid objectGuid = Guid.NewGuid();
                 scopeStorage2 = new ScopeStorage();
                 scopeStorage2[ADObjectSchema.OrganizationalUnitRoot] = bindingStorage.OrganizationalUnitRoot;
                 scopeStorage2.Name = objectGuid.ToString();
                 scopeStorage2.SetId(new ADObjectId(PolicyStorage.PoliciesContainer.GetChildId(scopeStorage2.Name).DistinguishedName, objectGuid));
                 bindingStorage.AppliedScopes.Add(scopeStorage2);
             }
             scopeStorage2.Mode          = Mode.Enforce;
             scopeStorage2.Scope         = BindingMetadata.ToStorage(addedScope);
             scopeStorage2.PolicyVersion = CombGuidGenerator.NewGuid();
         }
         bindingStorage.PolicyVersion = CombGuidGenerator.NewGuid();
         scopes.ResetChangeTracking();
     }
 }
Ejemplo n.º 9
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject.Identity,
                dataObject
            });
            ADOrganizationConfig adorganizationConfig = dataObject as ADOrganizationConfig;

            if (adorganizationConfig != null)
            {
                int?num = this.RetrieveSCLJunkThreshold(adorganizationConfig.Id);
                if (num != null)
                {
                    adorganizationConfig.SCLJunkThreshold = num.Value;
                }
                this.FillTaskPopulatedFields(adorganizationConfig);
                MultiValuedProperty <OrganizationSummaryEntry> multiValuedProperty = new MultiValuedProperty <OrganizationSummaryEntry>();
                foreach (OrganizationSummaryEntry organizationSummaryEntry in adorganizationConfig.OrganizationSummary)
                {
                    if (OrganizationSummaryEntry.IsValidKeyForCurrentRelease(organizationSummaryEntry.Key))
                    {
                        multiValuedProperty.Add(organizationSummaryEntry.Clone());
                    }
                }
                multiValuedProperty.ResetChangeTracking();
                adorganizationConfig.OrganizationSummary = multiValuedProperty;
                adorganizationConfig.ResetChangeTracking();
            }
            ADSessionSettings sessionSettings;

            if (this.AccountPartition == null)
            {
                sessionSettings = ADSessionSettings.RescopeToSubtree(base.OrgWideSessionSettings);
            }
            else
            {
                PartitionId partitionId = RecipientTaskHelper.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError));
                sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId);
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 109, "WriteResult", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\organization\\GetOrganization.cs");

            tenantOrRootOrgRecipientSession.UseConfigNC = true;
            ADMicrosoftExchangeRecipient admicrosoftExchangeRecipient = MailboxTaskHelper.FindMicrosoftExchangeRecipient(tenantOrRootOrgRecipientSession, (IConfigurationSession)base.DataSession);

            if (admicrosoftExchangeRecipient == null)
            {
                if (adorganizationConfig.SharedConfigurationInfo == null)
                {
                    if (!this.IsOnlyGatewayServerRoleExist())
                    {
                        this.WriteError(new InvalidOperationException(Strings.ErrorMicrosoftExchangeRecipientNotFound), ErrorCategory.ReadError, adorganizationConfig.Identity, false);
                    }
                    else
                    {
                        base.WriteVerbose(Strings.MicrosoftExchangeRecipientNotFoundOnGatewayServerRole);
                    }
                }
            }
            else
            {
                ValidationError[] array = admicrosoftExchangeRecipient.Validate();
                for (int i = 0; i < array.Length; i++)
                {
                    this.WriteWarning(array[i].Description);
                }
                adorganizationConfig.MicrosoftExchangeRecipientEmailAddresses            = admicrosoftExchangeRecipient.EmailAddresses;
                adorganizationConfig.MicrosoftExchangeRecipientReplyRecipient            = admicrosoftExchangeRecipient.ForwardingAddress;
                adorganizationConfig.MicrosoftExchangeRecipientEmailAddressPolicyEnabled = admicrosoftExchangeRecipient.EmailAddressPolicyEnabled;
                adorganizationConfig.MicrosoftExchangeRecipientPrimarySmtpAddress        = admicrosoftExchangeRecipient.PrimarySmtpAddress;
                adorganizationConfig.ResetChangeTracking();
            }
            bool flag = !OrganizationId.ForestWideOrgId.Equals(adorganizationConfig.OrganizationId);

            if (flag)
            {
                MultiValuedProperty <string> multiValuedProperty2 = this.AcceptedDomainNamesGetter(adorganizationConfig);
                if (multiValuedProperty2 != null)
                {
                    adorganizationConfig.AcceptedDomainNames = multiValuedProperty2;
                }
            }
            if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled)
            {
                adorganizationConfig.HierarchicalAddressBookRoot = this.GetHierarchicalAddressBookRootFromOU(adorganizationConfig.OrganizationId.OrganizationalUnit);
            }
            base.WriteResult(new OrganizationConfig(adorganizationConfig, flag));
            TaskLogger.LogExit();
        }