Exemplo n.º 1
0
        private bool TryGetCompanyState(string ouDN, EhfTargetConnection targetConnection, EhfADAdapter configADAdapter, out EhfAdminSyncState adminSyncState)
        {
            EhfADAdapter adadapter = this.ehfTargetConnection.ADAdapter;

            adminSyncState = null;
            ExSearchResultEntry exSearchResultEntry = adadapter.ReadObjectEntry(ouDN, false, EhfCompanyAdmins.ConfigUnitAttribute);

            if (exSearchResultEntry == null)
            {
                targetConnection.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Could not load object with DN <{0}>; Cannot determine the CompanyId", new object[]
                {
                    ouDN
                });
                return(false);
            }
            DirectoryAttribute attribute = exSearchResultEntry.GetAttribute("msExchCU");

            if (attribute == null)
            {
                targetConnection.DiagSession.LogAndTraceError("Could not load the Configuration Containter for {0}", new object[]
                {
                    ouDN
                });
                return(false);
            }
            string configUnitDN = (string)attribute[0];

            return(EhfCompanySynchronizer.TryGetEhfAdminSyncState(configUnitDN, configADAdapter, targetConnection, "Ignoring admin account changes, will retry in next sync cycle", out adminSyncState));
        }
Exemplo n.º 2
0
        public static EhfCompanyAdmins CreateEhfCompanyAdmins(EhfAdminSyncChangeBuilder ehfAdminSyncChangeBuilder, EhfTargetConnection ehfTargetConnection, EhfADAdapter configADAdapter)
        {
            ExSearchResultEntry exSearchResultEntry = configADAdapter.ReadObjectEntry(ehfAdminSyncChangeBuilder.ConfigUnitDN, false, EhfCompanyAdmins.OtherWellKnownObjectsAttribute);

            if (exSearchResultEntry == null)
            {
                ehfTargetConnection.DiagSession.LogAndTraceError("Could not find Configuration Unit for company {0}. The config naming context is either not replicated or the organization is deleted", new object[]
                {
                    ehfAdminSyncChangeBuilder.TenantOU
                });
                return(null);
            }
            string             text      = null;
            string             text2     = null;
            DirectoryAttribute attribute = exSearchResultEntry.GetAttribute("otherWellKnownObjects");

            if (attribute == null)
            {
                ehfTargetConnection.DiagSession.LogAndTraceError("Could not find OtherWellKnownObjects attribute in Configuration Unit object for company {0}.", new object[]
                {
                    ehfAdminSyncChangeBuilder.TenantOU
                });
                return(null);
            }
            foreach (object obj in attribute.GetValues(typeof(string)))
            {
                DNWithBinary dnwithBinary;
                if (DNWithBinary.TryParse(obj as string, out dnwithBinary))
                {
                    try
                    {
                        Guid b = new Guid(dnwithBinary.Binary);
                        if (WellKnownGuid.EoaWkGuid == b)
                        {
                            text = dnwithBinary.DistinguishedName;
                        }
                        if (WellKnownGuid.EraWkGuid == b)
                        {
                            text2 = dnwithBinary.DistinguishedName;
                        }
                        if (text != null && text2 != null)
                        {
                            break;
                        }
                    }
                    catch (ArgumentException exception)
                    {
                        ehfTargetConnection.DiagSession.LogAndTraceException(exception, "OtherWellKnownObjects attribute for company {0} contains an entry with invalid Binary part.", new object[]
                        {
                            ehfAdminSyncChangeBuilder.TenantOU
                        });
                    }
                }
            }
            return(new EhfCompanyAdmins(ehfAdminSyncChangeBuilder, ehfTargetConnection, text, text2, configADAdapter));
        }
Exemplo n.º 3
0
        private static bool TryGetPerimeterConfigEntry(string configUnitDN, EhfADAdapter adAdapter, EdgeSyncDiag diagSession, string missingIdAction, string[] attributes, out ExSearchResultEntry perimeterSettingsEntry)
        {
            ADObjectId perimeterConfigObjectIdFromConfigUnitId = EhfTargetConnection.GetPerimeterConfigObjectIdFromConfigUnitId(new ADObjectId(configUnitDN));

            perimeterSettingsEntry = adAdapter.ReadObjectEntry(perimeterConfigObjectIdFromConfigUnitId.DistinguishedName, false, attributes);
            if (perimeterSettingsEntry == null)
            {
                diagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Unable to read Perimeter Settings object for ConfigUnit root DN <{0}>; {1}", new object[]
                {
                    configUnitDN,
                    missingIdAction
                });
                return(false);
            }
            return(true);
        }