Ejemplo n.º 1
0
        public void Save(IConfigurable instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            if (this.configurationSession.ReadOnly)
            {
                throw new InvalidOperationException("read only");
            }
            if (this.serviceInstanceName == null)
            {
                throw new InvalidOperationException("Save can be performed only for specific service instance.");
            }
            FullSyncObjectRequest request = instance as FullSyncObjectRequest;

            if (request == null)
            {
                throw new NotSupportedException(instance.GetType().FullName);
            }
            this.RefreshRidMasterInformation();
            MsoMainStreamCookieContainer msoMainStreamCookieContainer = this.configurationSession.GetMsoMainStreamCookieContainer(this.serviceInstanceName);
            MultiValuedProperty <FullSyncObjectRequest> msoForwardSyncObjectFullSyncRequests = msoMainStreamCookieContainer.MsoForwardSyncObjectFullSyncRequests;
            FullSyncObjectRequest fullSyncObjectRequest = msoForwardSyncObjectFullSyncRequests.Find((FullSyncObjectRequest r) => request.Identity.Equals(r.Identity) && request.ServiceInstanceId == r.ServiceInstanceId);

            if (fullSyncObjectRequest != null)
            {
                if (request.ObjectState == ObjectState.New)
                {
                    throw new ADObjectAlreadyExistsException(DirectoryStrings.ExceptionADOperationFailedAlreadyExist(this.configurationSession.DomainController, request.ToString()));
                }
                if (request.ObjectState == ObjectState.Changed)
                {
                    msoForwardSyncObjectFullSyncRequests.Remove(fullSyncObjectRequest);
                }
            }
            else
            {
                IEnumerable <FullSyncObjectRequest> source = from r in msoForwardSyncObjectFullSyncRequests
                                                             where request.ServiceInstanceId == r.ServiceInstanceId
                                                             select r;
                int maxObjectFullSyncRequestsPerServiceInstance = ProvisioningTasksConfigImpl.MaxObjectFullSyncRequestsPerServiceInstance;
                if (source.Count <FullSyncObjectRequest>() >= maxObjectFullSyncRequestsPerServiceInstance)
                {
                    throw new DataSourceOperationException(Strings.OperationExceedsPerServiceInstanceFullSyncObjectRequestLimit(maxObjectFullSyncRequestsPerServiceInstance, request.ServiceInstanceId));
                }
            }
            msoForwardSyncObjectFullSyncRequests.Add(request);
            this.configurationSession.Save(msoMainStreamCookieContainer);
        }
Ejemplo n.º 2
0
        internal void ApplyChangesToDownlevelData(ExchangeRole parentRole)
        {
            if (parentRole == null)
            {
                throw new ArgumentNullException("parentRole");
            }
            if (!this.HasDownlevelData)
            {
                return;
            }
            MultiValuedProperty <RoleEntry> multiValuedProperty = (MultiValuedProperty <RoleEntry>) this[ExchangeRoleSchema.InternalDownlevelRoleEntries];

            object[] removed = this.RoleEntries.Removed;
            for (int i = 0; i < removed.Length; i++)
            {
                RoleEntry roleEntry            = (RoleEntry)removed[i];
                RoleEntry downlevelEntryToFind = roleEntry.MapToPreviousVersion();
                RoleEntry roleEntry2           = multiValuedProperty.Find((RoleEntry dre) => 0 == RoleEntry.CompareRoleEntriesByName(dre, downlevelEntryToFind));
                if (roleEntry2 != null)
                {
                    multiValuedProperty.Remove(roleEntry2);
                }
            }
            object[] added = this.RoleEntries.Added;
            for (int j = 0; j < added.Length; j++)
            {
                RoleEntry roleEntry3           = (RoleEntry)added[j];
                RoleEntry downlevelEntryToFind = roleEntry3.MapToPreviousVersion();
                MultiValuedProperty <RoleEntry> multiValuedProperty2 = (MultiValuedProperty <RoleEntry>)parentRole[ExchangeRoleSchema.InternalDownlevelRoleEntries];
                RoleEntry roleEntry4 = multiValuedProperty2.Find((RoleEntry dre) => 0 == RoleEntry.CompareRoleEntriesByName(dre, downlevelEntryToFind));
                if (!(roleEntry4 == null))
                {
                    List <string> list = new List <string>();
                    foreach (string newParameter in roleEntry3.Parameters)
                    {
                        string text = roleEntry3.MapParameterToPreviousVersion(newParameter);
                        if (roleEntry4.ContainsParameter(text))
                        {
                            list.Add(text);
                        }
                    }
                    RoleEntry item = downlevelEntryToFind.Clone(list);
                    multiValuedProperty.Add(item);
                }
            }
        }
Ejemplo n.º 3
0
        public static object AuthSchemeGetter(IPropertyBag propertyBag)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[AuthRedirectSchema.Keywords];
            string     value      = multiValuedProperty.Find((string x) => !string.Equals(x, AuthRedirect.AuthRedirectKeywords, StringComparison.OrdinalIgnoreCase));
            AuthScheme authScheme = Microsoft.Exchange.Data.Directory.SystemConfiguration.AuthScheme.Unknown;

            if (!string.IsNullOrEmpty(value))
            {
                try
                {
                    authScheme = (AuthScheme)Enum.Parse(typeof(AuthScheme), value, true);
                }
                catch (ArgumentException)
                {
                }
            }
            return(authScheme);
        }
Ejemplo n.º 4
0
        private MultiValuedProperty <ADObjectId> MergeArraysIntoList(params MultiValuedProperty <ADObjectId>[] propertyArrayArray)
        {
            MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();

            foreach (MultiValuedProperty <ADObjectId> multiValuedProperty2 in propertyArrayArray)
            {
                if (multiValuedProperty2 != null)
                {
                    using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty2.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ADObjectId value = enumerator.Current;
                            if (multiValuedProperty.Find((ADObjectId b) => ADObjectId.Equals(value, b)) == null)
                            {
                                multiValuedProperty.Add(value);
                            }
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }