private static bool LoadAcceptedDomain(ExSearchResultEntry entry, Connection sourceConnection, TargetConnection targetConnection, object state)
        {
            EhfConfigTargetConnection ehfConfigTargetConnection = (EhfConfigTargetConnection)targetConnection;

            if (!EhfSynchronizer.LoadFullEntry(entry, EhfDomainSynchronizer.AcceptedDomainAllAttributes, ehfConfigTargetConnection))
            {
                return(false);
            }
            if (!EhfDomainSynchronizer.ValidateDomainName(entry, ehfConfigTargetConnection.DiagSession))
            {
                return(false);
            }
            string configUnitDN = null;

            if (!EhfDomainSynchronizer.TryGetConfigUnit(entry, ehfConfigTargetConnection.DiagSession, out configUnitDN))
            {
                return(false);
            }
            EhfCompanyIdentity ehfCompanyIdentity;

            if (!ehfConfigTargetConnection.TryGetEhfCompanyIdentity(configUnitDN, "ignoring the object", out ehfCompanyIdentity))
            {
                return(false);
            }
            EhfDomainSynchronizer.AddAttributeToChangeEntry(entry, "msExchTenantPerimeterSettingsOrgID", ehfCompanyIdentity.EhfCompanyId.ToString());
            EhfDomainSynchronizer.AddAttributeToChangeEntry(entry, "msEdgeSyncEhfCompanyGuid", ehfCompanyIdentity.EhfCompanyGuid.ToString());
            return(true);
        }
        private void CreateEhfDomainForNewCompany(ExSearchResultEntry entry, int ehfCompanyId)
        {
            EhfDomainItem ehfDomainItem = this.CreateDomainItemForNewCompany(entry, ehfCompanyId);

            if (ehfDomainItem == null)
            {
                base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Ignoring domain <{0}> for newly-created EHF company <{1}>", new object[]
                {
                    entry.DistinguishedName,
                    ehfCompanyId
                });
                return;
            }
            if (!EhfDomainSynchronizer.ValidateDomainName(entry, base.DiagSession))
            {
                base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Ignoring unsupported domain <{0}> for newly-created EHF company <{1}>", new object[]
                {
                    entry.DistinguishedName,
                    ehfCompanyId
                });
                return;
            }
            base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Creating domain <{0}> for newly-created EHF company <{1}>", new object[]
            {
                entry.DistinguishedName,
                ehfCompanyId
            });
            this.AddDomainToCreateBatch(ehfDomainItem);
        }
        public void CreateEhfDomainsForNewCompany(string transportSettingsDN, int ehfCompanyId, Guid ehfCompanyGuid)
        {
            if (ehfCompanyGuid == Guid.Empty)
            {
                throw new ArgumentException("Ehf company Guid is empty for company " + transportSettingsDN, "ehfCompanyGuid");
            }
            IEnumerable <ExSearchResultEntry> enumerable = base.ADAdapter.PagedScan(transportSettingsDN, Schema.Query.QueryAcceptedDomains, EhfDomainSynchronizer.AcceptedDomainAllAttributes);

            foreach (ExSearchResultEntry entry in enumerable)
            {
                EhfDomainSynchronizer.AddAttributeToChangeEntry(entry, "msEdgeSyncEhfCompanyGuid", ehfCompanyGuid.ToString());
                this.CreateEhfDomainForNewCompany(entry, ehfCompanyId);
            }
            if (!this.SetForcedDomainSyncOnLastDomain(ehfCompanyGuid))
            {
                try
                {
                    EhfDomainItem.ClearForceDomainSyncFlagFromPerimeterConfig(base.ADAdapter, ehfCompanyGuid);
                }
                catch (ExDirectoryException ex)
                {
                    if (ex.ResultCode == ResultCode.NoSuchObject)
                    {
                        base.DiagSession.LogAndTraceException(ex, "NoSuchObject error occurred while trying to clear the ForceDomainSync flag in Perimeter Settings for Company <{0}>:<{1}>", new object[]
                        {
                            transportSettingsDN,
                            ehfCompanyGuid
                        });
                    }
                    else
                    {
                        base.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to clear the ForceDomainSync flag in Perimeter Settings for company <{0}>:<{1}>", new object[]
                        {
                            transportSettingsDN,
                            ehfCompanyGuid
                        });
                        base.DiagSession.EventLog.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfFailedToClearForceDomainSyncFlagFromCompanySync, null, new object[]
                        {
                            transportSettingsDN,
                            ex.Message
                        });
                    }
                }
            }
        }
Exemplo n.º 4
0
        public override List <TypeSynchronizer> CreateTypeSynchronizer(SyncTreeType type)
        {
            List <TypeSynchronizer> list = new List <TypeSynchronizer>();

            if (this.ehfWebServiceVersion != EhfWebServiceVersion.Version1 && this.ehfWebServiceVersion != EhfWebServiceVersion.Version2)
            {
                EdgeSyncEvents.Log.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfWebServiceVersionIsNotSupported, null, new object[]
                {
                    this.ehfWebServiceVersion,
                    this.identity
                });
                return(list);
            }
            if (type == SyncTreeType.Configuration)
            {
                list.Add(EhfCompanySynchronizer.CreateTypeSynchronizer());
                list.Add(EhfDomainSynchronizer.CreateTypeSynchronizer());
            }
            else if (type == SyncTreeType.Recipients)
            {
                list.Add(EhfAdminAccountSynchronizer.CreateTypeSynchronizer());
            }
            return(list);
        }