Ejemplo n.º 1
0
 public static EhfAdminSyncState Create(EhfCompanyIdentity companyIdentity, ExSearchResultEntry entry, EhfTargetConnection targetConnection)
 {
     return(new EhfAdminSyncState(companyIdentity, targetConnection)
     {
         orgAdminMembers = EhfAdminSyncState.GetAdminStateFromAttribute(entry, "msExchTargetServerAdmins"),
         viewOnlyOrgAdminMembers = EhfAdminSyncState.GetAdminStateFromAttribute(entry, "msExchTargetServerViewOnlyAdmins"),
         adminAgentMembers = EhfAdminSyncState.GetAdminStateFromAttribute(entry, "msExchTargetServerPartnerAdmins"),
         helpDeskAgentMembers = EhfAdminSyncState.GetAdminStateFromAttribute(entry, "msExchTargetServerPartnerViewOnlyAdmins")
     });
 }
Ejemplo n.º 2
0
        public static EhfAdminSyncState Create(EhfCompanyAdmins admins, bool addOrgAdminState, bool addViewOnlyOrgAdminState, bool addAdminAgentState, bool addHelpDeskAgentState, EhfTargetConnection targetConnection)
        {
            EhfAdminSyncState ehfAdminSyncState  = admins.EhfAdminSyncState;
            EhfAdminSyncState ehfAdminSyncState2 = new EhfAdminSyncState(admins.EhfCompanyIdentity, targetConnection);

            ehfAdminSyncState2.orgAdminMembers         = ehfAdminSyncState2.GetNewState(admins.OrganizationMangement, ehfAdminSyncState.orgAdminMembers, addOrgAdminState);
            ehfAdminSyncState2.viewOnlyOrgAdminMembers = ehfAdminSyncState2.GetNewState(admins.ViewonlyOrganizationManagement, ehfAdminSyncState.viewOnlyOrgAdminMembers, addViewOnlyOrgAdminState);
            ehfAdminSyncState2.adminAgentMembers       = ehfAdminSyncState2.GetNewState(admins.AdminAgent, ehfAdminSyncState.adminAgentMembers, addAdminAgentState);
            ehfAdminSyncState2.helpDeskAgentMembers    = ehfAdminSyncState2.GetNewState(admins.HelpdeskAgent, ehfAdminSyncState.helpDeskAgentMembers, addHelpDeskAgentState);
            return(ehfAdminSyncState2);
        }
Ejemplo n.º 3
0
        public static bool TryGetEhfAdminSyncState(string configUnitDN, EhfADAdapter adAdapter, EhfTargetConnection targetConnection, string missingIdAction, out EhfAdminSyncState ehfAdminSyncState)
        {
            ehfAdminSyncState = null;
            string[]            adminSyncPerimeterSettingsAttributes = EhfCompanySynchronizer.AdminSyncPerimeterSettingsAttributes;
            ExSearchResultEntry exSearchResultEntry;

            if (!EhfCompanySynchronizer.TryGetPerimeterConfigEntry(configUnitDN, adAdapter, targetConnection.DiagSession, missingIdAction, adminSyncPerimeterSettingsAttributes, out exSearchResultEntry))
            {
                return(false);
            }
            EhfCompanyIdentity ehfCompanyIdentity = EhfCompanySynchronizer.GetEhfCompanyIdentity(configUnitDN, targetConnection.DiagSession, missingIdAction, exSearchResultEntry);

            ehfAdminSyncState = EhfAdminSyncState.Create(ehfCompanyIdentity, exSearchResultEntry, targetConnection);
            return(true);
        }
Ejemplo n.º 4
0
        private void UpdateSyncStateInAD(EhfCompanyAdmins admins, EhfADAdapter configADAdapter, bool syncAdminAccountsCompleted, bool syncAdminAgentCompleted, bool syncHelpdeskAgentCompleted)
        {
            EhfAdminSyncState ehfAdminSyncState = EhfAdminSyncState.Create(admins, syncAdminAccountsCompleted, syncAdminAccountsCompleted, syncAdminAgentCompleted, syncHelpdeskAgentCompleted, base.EhfConnection);

            if (ehfAdminSyncState.IsEmpty)
            {
                base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Admin state is up to date for <{0}>. No need to update the state.", new object[]
                {
                    admins.TenantOU
                });
                return;
            }
            try
            {
                configADAdapter.SetAttributeValues(admins.EhfCompanyIdentity.EhfCompanyGuid, ehfAdminSyncState.GetStatesToUpdate());
            }
            catch (ExDirectoryException exception)
            {
                this.HandleFaultAsTransientFailure(admins.EhfCompanyIdentity, "Update Sync State", exception, true, string.Empty);
            }
        }
Ejemplo n.º 5
0
 public IEnumerable <KeyValuePair <string, List <byte[]> > > GetStatesToUpdate()
 {
     if (this.IsEmpty)
     {
         throw new InvalidOperationException("Should not update the state in AD if there is no change to update.");
     }
     if (this.orgAdminMembers != null)
     {
         yield return(EhfAdminSyncState.GetStateToUpdateForAttribute(this.orgAdminMembers, "msExchTargetServerAdmins"));
     }
     if (this.viewOnlyOrgAdminMembers != null)
     {
         yield return(EhfAdminSyncState.GetStateToUpdateForAttribute(this.viewOnlyOrgAdminMembers, "msExchTargetServerViewOnlyAdmins"));
     }
     if (this.adminAgentMembers != null)
     {
         yield return(EhfAdminSyncState.GetStateToUpdateForAttribute(this.adminAgentMembers, "msExchTargetServerPartnerAdmins"));
     }
     if (this.helpDeskAgentMembers != null)
     {
         yield return(EhfAdminSyncState.GetStateToUpdateForAttribute(this.helpDeskAgentMembers, "msExchTargetServerPartnerViewOnlyAdmins"));
     }
     yield break;
 }
Ejemplo n.º 6
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));
        }