public virtual void SetAttributeValues(Guid objectGuid, IEnumerable <KeyValuePair <string, object> > attributes) { if (this.connection == null) { throw new InvalidOperationException("AD connection has not been initialized"); } ModifyRequest modifyRequest = new ModifyRequest(); modifyRequest.DistinguishedName = EhfADAdapter.CreateDNForObjectGuid(objectGuid); foreach (KeyValuePair <string, object> keyValuePair in attributes) { DirectoryAttributeModification directoryAttributeModification = new DirectoryAttributeModification(); directoryAttributeModification.Operation = DirectoryAttributeOperation.Replace; directoryAttributeModification.Name = keyValuePair.Key; if (keyValuePair.Value != null) { string text = keyValuePair.Value as string; if (text != null) { directoryAttributeModification.Add(text); } else { byte[] array = keyValuePair.Value as byte[]; if (array == null) { throw new ArgumentException("Value of the attribute should be of type String or Byte[]", "attributesAndValues"); } directoryAttributeModification.Add(array); } } modifyRequest.Modifications.Add(directoryAttributeModification); } this.connection.SendRequest(modifyRequest); }
public virtual void SetAttributeValues(Guid objectGuid, IEnumerable <KeyValuePair <string, List <byte[]> > > attributes) { if (this.connection == null) { throw new InvalidOperationException("AD connection has not been initialized"); } ModifyRequest modifyRequest = new ModifyRequest(); modifyRequest.DistinguishedName = EhfADAdapter.CreateDNForObjectGuid(objectGuid); foreach (KeyValuePair <string, List <byte[]> > keyValuePair in attributes) { DirectoryAttributeModification directoryAttributeModification = new DirectoryAttributeModification(); directoryAttributeModification.Operation = DirectoryAttributeOperation.Replace; directoryAttributeModification.Name = keyValuePair.Key; if (keyValuePair.Value != null && keyValuePair.Value.Count > 0) { foreach (byte[] value in keyValuePair.Value) { directoryAttributeModification.Add(value); } } modifyRequest.Modifications.Add(directoryAttributeModification); } this.connection.SendRequest(modifyRequest); }
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)); }
public EhfADResultCode TrySetDuplicateDomain(EhfADAdapter ehfADAdapter, bool isDuplicate) { int flagsValue = base.GetFlagsValue("msExchTransportInboundSettings"); int num; if (isDuplicate) { num = (flagsValue | 1); } else { num = (flagsValue & -2); } if (flagsValue == num) { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "DuplicateDetected field is set to the expected value {0} for domain <{1}>:<{2}>. Not setting the value.", new object[] { flagsValue, base.DistinguishedName, base.GetDomainGuid() }); return(EhfADResultCode.Success); } EhfADResultCode result; try { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Setting DuplicateDetected field from {0} to {1} for domain <{2}>:<{3}>.", new object[] { flagsValue, num, base.DistinguishedName, base.GetDomainGuid() }); ehfADAdapter.SetAttributeValue(base.GetDomainGuid(), "msExchTransportInboundSettings", num.ToString()); result = EhfADResultCode.Success; } catch (ExDirectoryException ex) { if (ex.ResultCode == ResultCode.NoSuchObject) { base.DiagSession.LogAndTraceException(ex, "NoSuchObject error occurred while trying to set the DuplicateDetected flag for domain <{0}>:<{1}>", new object[] { base.DistinguishedName, base.GetDomainGuid() }); result = EhfADResultCode.NoSuchObject; } else { base.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to set the DuplicateDetected flag for domain <{0}>:<{1}>", new object[] { base.DistinguishedName, base.GetDomainGuid() }); result = EhfADResultCode.Failure; } } return(result); }
private void CacheAdminSyncState(EhfADAdapter configADAdapter) { if (this.ehfAdminSyncState != null) { return; } this.TryGetCompanyState(this.tenantOU, this.ehfTargetConnection, configADAdapter, out this.ehfAdminSyncState); }
private bool TryStoreSyncErrors(EhfADAdapter adapter) { object[] array = null; string text = null; if (this.ContainsCurrentSyncErrors) { array = new object[this.syncErrors.Count]; for (int i = 0; i < this.syncErrors.Count; i++) { array[i] = this.syncErrors[i]; } text = "save"; } else if (this.ContainsPreviousSyncErrors) { text = "remove"; } if (text == null) { return(true); } Guid objectGuid = this.GetObjectGuid(); try { adapter.SetAttributeValues(objectGuid, "msExchEdgeSyncCookies", array); } catch (ExDirectoryException ex) { if (ex.ResultCode == ResultCode.NoSuchObject) { this.DiagSession.LogAndTraceException(ex, "NoSuchObject error occurred while trying to {0} sync errors for AD object <{1}>:<{2}>; ignoring the error", new object[] { text, this.DistinguishedName, objectGuid }); return(true); } this.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to {0} sync errors for AD object <{1}>:<{2}>", new object[] { text, this.DistinguishedName, objectGuid }); this.DiagSession.EventLog.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfFailedUpdateSyncErrors, this.DistinguishedName, new object[] { this.DistinguishedName, text, ex }); return(false); } this.DiagSession.Tracer.TraceDebug <string, string, Guid>((long)this.DiagSession.GetHashCode(), "Successfully {0}d sync errors for AD object <{1}>:<{2}>", text, this.DistinguishedName, objectGuid); return(true); }
public EhfCompanyAdmins Flush(EhfADAdapter configADAdapter) { if (this.flushed) { throw new InvalidOperationException("Flush() should be called only once"); } this.flushed = true; return(EhfCompanyAdmins.CreateEhfCompanyAdmins(this, this.ehfTargetConnection, configADAdapter)); }
private static bool TryGetEhfCompanyIdentity(string configUnitDN, EhfADAdapter adAdapter, EhfTargetConnection targetConnection, string missingIdAction, out EhfCompanyIdentity ehfCompanyIdentity) { ehfCompanyIdentity = null; string[] perimeterSettingsCompanyIdentityAttributes = EhfCompanySynchronizer.PerimeterSettingsCompanyIdentityAttributes; ExSearchResultEntry perimeterSettingsEntry; if (!EhfCompanySynchronizer.TryGetPerimeterConfigEntry(configUnitDN, adAdapter, targetConnection.DiagSession, missingIdAction, perimeterSettingsCompanyIdentityAttributes, out perimeterSettingsEntry)) { return(false); } ehfCompanyIdentity = EhfCompanySynchronizer.GetEhfCompanyIdentity(configUnitDN, targetConnection.DiagSession, missingIdAction, perimeterSettingsEntry); return(true); }
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); }
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); }
public EhfADResultCode TryClearForceDomainSyncFlagFromPerimeterConfig(EhfADAdapter adAdapter) { if (!this.clearForceDomainSyncFlag) { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.High, "Domain <{0}> does not have [clearForceDomainSyncFlag] set. Not clearing the forceDomainSync flag", new object[] { base.DistinguishedName }); return(EhfADResultCode.Success); } Guid entryCompanyGuid = this.GetEntryCompanyGuid(); base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "Clearing the force-domainsync flag set on the perimeterconfig with Guid <{0}> for domain <{1}>.", new object[] { entryCompanyGuid, base.DistinguishedName }); try { EhfDomainItem.ClearForceDomainSyncFlagFromPerimeterConfig(adAdapter, entryCompanyGuid); } 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 domain <{0}>:<{1}>", new object[] { base.DistinguishedName, entryCompanyGuid }); return(EhfADResultCode.NoSuchObject); } base.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to clear the ForceDomainSync flag in Perimeter Settings for domain <{0}>:<{1}>", new object[] { base.DistinguishedName, entryCompanyGuid }); base.DiagSession.EventLog.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfFailedToClearForceDomainSyncFlagFromDomainSync, null, new object[] { base.DistinguishedName, ex.Message }); return(EhfADResultCode.Failure); } return(EhfADResultCode.Success); }
public virtual void SetAttributeValues(Guid objectGuid, string attrName, object[] values) { if (this.connection == null) { throw new InvalidOperationException("AD connection has not been initialized"); } string distinguishedName = EhfADAdapter.CreateDNForObjectGuid(objectGuid); ModifyRequest request; if (values != null && values.Length > 0) { request = new ModifyRequest(distinguishedName, DirectoryAttributeOperation.Replace, attrName, values); } else { request = new ModifyRequest(distinguishedName, DirectoryAttributeOperation.Replace, attrName, new object[0]); } this.connection.SendRequest(request); }
public virtual EhfADAdapter GetConfigADAdapter(EdgeSyncDiag diagSession, out Exception exception) { exception = null; IConfigurationSession configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.connection.Fqdn, true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 339, "GetConfigADAdapter", "f:\\15.00.1497\\sources\\dev\\EdgeSync\\src\\EHF\\EhfADAdapter.cs"); ADObjectId rootId = null; PooledLdapConnection pooledLdapConnection = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { pooledLdapConnection = configSession.GetReadConnection(configSession.DomainController, ref rootId); }, 3); if (adoperationResult.Succeeded) { EhfADAdapter ehfADAdapter = new EhfADAdapter(); ehfADAdapter.SetConnection(new Connection(pooledLdapConnection)); return(ehfADAdapter); } exception = adoperationResult.Exception; return(null); }
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); } }
public EhfConfigTargetConnection(int localServerVersion, EhfTargetServerConfig config, EdgeSyncLogSession logSession, EhfPerfCounterHandler perfCounterHandler, IProvisioningService provisioningService, IManagementService managementService, EhfADAdapter adapter, EnhancedTimeSpan syncInterval) : base(localServerVersion, config, logSession, perfCounterHandler, provisioningService, managementService, null, adapter, syncInterval) { }
private void InvokeSyncAdminAccountsAndSyncGroupUsers(EhfCompanyAdmins admin, EhfADAdapter configADAdapter) { bool syncAdminAccountsCompleted = true; bool syncAdminAgentCompleted = true; bool syncHelpdeskAgentCompleted = true; if (admin.HasLocalAdminChanges) { FailedAdminAccounts syncAdminAccountsResponse = null; FaultException syncAdminException = null; string syncAdminsOperation = EhfAdminAccountSynchronizer.SyncAdminsOperation; base.InvokeProvisioningService(syncAdminsOperation, delegate { syncAdminAccountsResponse = this.ProvisioningService.SyncAdminAccounts(admin.GetLocalAdminsToSync(this.DiagSession), out syncAdminException); }, 1); if (syncAdminException != null) { this.HandleOperationLevelException(syncAdminException, syncAdminsOperation, admin.EhfCompanyIdentity); } else { this.ProcessSyncAdminAccountsResponse(syncAdminAccountsResponse, admin, syncAdminsOperation); } syncAdminAccountsCompleted = (syncAdminException == null); } if (admin.HasPartnerAdminGroupChanges) { syncAdminAgentCompleted = this.InvokeSyncGroupUsers(admin.EhfCompanyIdentity, admin.AdminAgent, admin.TenantOU); syncHelpdeskAgentCompleted = this.InvokeSyncGroupUsers(admin.EhfCompanyIdentity, admin.HelpdeskAgent, admin.TenantOU); } this.UpdateSyncStateInAD(admin, configADAdapter, syncAdminAccountsCompleted, syncAdminAgentCompleted, syncHelpdeskAgentCompleted); }
public override bool FlushBatches() { if (this.adminAccountChange.Count == 0 && this.groupsToRemove.Count == 0) { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "{0}: No admin changes to Sync to FOSE", new object[] { EhfAdminAccountSynchronizer.cycleCount }); return(true); } this.InvokeRemoveGroups(); if (this.adminAccountChange.Count != 0) { Exception ex; EhfADAdapter configADAdapter = base.ADAdapter.GetConfigADAdapter(base.DiagSession, out ex); if (configADAdapter == null) { base.DiagSession.LogAndTraceError("Could not create a LDAP connection to the Configuration naming context. Details {0}", new object[] { ex }); base.DiagSession.EventLog.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfAdminSyncFailedToConnectToConfigNamingContext, null, new object[] { ex.Message }); base.EhfConnection.AbortSyncCycle(ex); return(false); } base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "{0} : Changes to <{1}> tenant(s) detected. Checking if sync is required.", new object[] { EhfAdminAccountSynchronizer.cycleCount.ToString(), this.adminAccountChange.Count.ToString() }); foreach (KeyValuePair <string, EhfAdminSyncChangeBuilder> keyValuePair in this.adminAccountChange) { this.AbortSyncCycleIfTooManyFailures(); EhfAdminSyncChangeBuilder value = keyValuePair.Value; if (value.ChangeExists) { EhfCompanyAdmins ehfCompanyAdmins = value.Flush(configADAdapter); if (ehfCompanyAdmins == null) { this.errorTracker.AddCriticalFailure(); } else if (ehfCompanyAdmins.IsSyncRequired) { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "AdminSync: {0}", new object[] { ehfCompanyAdmins }); if (ehfCompanyAdmins.CompanyId != 0) { this.InvokeSyncAdminAccountsAndSyncGroupUsers(ehfCompanyAdmins, configADAdapter); } else { base.DiagSession.LogAndTraceError("Not syncing {0} since companyId is not set", new object[] { ehfCompanyAdmins.TenantOU }); if (!ehfCompanyAdmins.PerimeterConfigNotReplicatedOrIsDeleted) { this.errorTracker.AddTransientFailure(ehfCompanyAdmins.EhfCompanyIdentity, new EhfAdminAccountSynchronizer.EhfAdminSyncTransientException("PerimeterConfig object does not have Ehf CompanyId set."), string.Empty); } else { this.errorTracker.AddCriticalFailure(); } } } else { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "No adminsync is required for: {0}", new object[] { keyValuePair.Key }); } value.ClearCachedChanges(); } } this.adminAccountChange.Clear(); } return(true); }
public bool EventLogAndTryStoreSyncErrors(EhfADAdapter adapter) { this.EventLogSyncErrors(); return(this.entry.IsDeleted || this.TryStoreSyncErrors(adapter)); }
private EhfCompanyAdmins(EhfAdminSyncChangeBuilder builder, EhfTargetConnection targetConnection, string orgManagementGroupDN, string viewOnlyOrgManagementGroupDN, EhfADAdapter configADAdapter) { EhfWellKnownGroup ehfWellKnownGroup = null; EhfWellKnownGroup ehfWellKnownGroup2 = null; EhfWellKnownGroup ehfWellKnownGroup3 = null; EhfWellKnownGroup ehfWellKnownGroup4 = null; this.tenantOU = builder.TenantOU; this.ehfTargetConnection = targetConnection; if (builder.DeletedObjects.Count != 0) { this.CacheAdminSyncState(configADAdapter); } bool flag = builder.UpdateOrgManagementGroup || builder.HasDirectChangeForGroup(orgManagementGroupDN) || (this.ehfAdminSyncState != null && this.AdminGroupMemberDeleted(builder, this.ehfAdminSyncState.OrganizationManagmentMembers, orgManagementGroupDN)); bool flag2 = builder.UpdateViewOnlyOrgManagementGroup || builder.HasDirectChangeForGroup(viewOnlyOrgManagementGroupDN) || (this.ehfAdminSyncState != null && this.AdminGroupMemberDeleted(builder, this.ehfAdminSyncState.ViewOnlyOrganizationManagmentMembers, viewOnlyOrgManagementGroupDN)); bool flag3 = builder.UpdateAdminAgentGroup || (this.ehfAdminSyncState != null && this.AdminGroupMemberDeleted(builder, this.ehfAdminSyncState.AdminAgentMembers, EhfCompanyAdmins.AdminAgentGroupNamePrefix)); bool flag4 = builder.UpdateHelpdeskAgentGroup || (this.ehfAdminSyncState != null && this.AdminGroupMemberDeleted(builder, this.ehfAdminSyncState.HelpdeskAgentMembers, EhfCompanyAdmins.HelpdeskAgentGroupNamePrefix)); if ((flag || builder.GroupChanges.Count != 0 || builder.LiveIdChanges.Count != 0) && orgManagementGroupDN != null) { ehfWellKnownGroup = this.GetMembersOfGroupFromDN(orgManagementGroupDN, false, targetConnection.DiagSession); } if ((flag2 || builder.GroupChanges.Count != 0 || builder.LiveIdChanges.Count != 0) && viewOnlyOrgManagementGroupDN != null) { ehfWellKnownGroup2 = this.GetMembersOfGroupFromDN(viewOnlyOrgManagementGroupDN, false, targetConnection.DiagSession); } if (builder.GroupChanges.Count != 0 || builder.LiveIdChanges.Count != 0 || flag3 || flag4) { string text = null; string text2 = null; foreach (ExSearchResultEntry exSearchResultEntry in this.ehfTargetConnection.ADAdapter.PagedScan(this.tenantOU, EhfCompanyAdmins.PartnerAdminGroupFilter, new string[0])) { targetConnection.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "Found a Partner Admin group {0}", new object[] { exSearchResultEntry.DistinguishedName }); if (exSearchResultEntry.DistinguishedName.StartsWith(EhfWellKnownGroup.AdminAgentGroupDnPrefix)) { text = exSearchResultEntry.DistinguishedName; } else if (exSearchResultEntry.DistinguishedName.StartsWith(EhfWellKnownGroup.HelpdeskAgentGroupDnPrefix)) { text2 = exSearchResultEntry.DistinguishedName; } } targetConnection.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "AdminAgentPartnerGroup={0}; HelpDeskAgentPartnerGroup = {1}", new object[] { text ?? "<null>", text2 ?? "<null>" }); if (flag3 && text != null) { ehfWellKnownGroup3 = this.GetMembersOfGroupFromDN(text, true, targetConnection.DiagSession); } if (flag4 && text2 != null) { ehfWellKnownGroup4 = this.GetMembersOfGroupFromDN(text2, true, targetConnection.DiagSession); } } EdgeSyncDiag diagSession = builder.EhfTargetConnection.DiagSession; if (!flag && ehfWellKnownGroup != null && (EhfCompanyAdmins.RelevantChangePresent <AdminSyncUser>(builder.GroupChanges, ehfWellKnownGroup.SubGroups, diagSession) || EhfCompanyAdmins.RelevantChangePresent <MailboxAdminSyncUser>(builder.LiveIdChanges, ehfWellKnownGroup.GroupMembers, diagSession))) { flag = true; } if (!flag2 && ehfWellKnownGroup2 != null && (EhfCompanyAdmins.RelevantChangePresent <AdminSyncUser>(builder.GroupChanges, ehfWellKnownGroup2.SubGroups, diagSession) || EhfCompanyAdmins.RelevantChangePresent <MailboxAdminSyncUser>(builder.LiveIdChanges, ehfWellKnownGroup2.GroupMembers, diagSession))) { flag2 = true; } if (!flag3 && ehfWellKnownGroup3 != null && (EhfCompanyAdmins.RelevantChangePresent <AdminSyncUser>(builder.GroupChanges, ehfWellKnownGroup3.SubGroups, diagSession) || EhfCompanyAdmins.RelevantChangePresent <MailboxAdminSyncUser>(builder.LiveIdChanges, ehfWellKnownGroup3.GroupMembers, diagSession))) { flag3 = true; } if (!flag4 && ehfWellKnownGroup4 != null && (EhfCompanyAdmins.RelevantChangePresent <AdminSyncUser>(builder.GroupChanges, ehfWellKnownGroup4.SubGroups, diagSession) || EhfCompanyAdmins.RelevantChangePresent <MailboxAdminSyncUser>(builder.LiveIdChanges, ehfWellKnownGroup4.GroupMembers, diagSession))) { flag4 = true; } if (flag) { this.organizationManagement = ehfWellKnownGroup; } if (flag2) { this.viewOnlyOrganizationManagement = ehfWellKnownGroup2; } if (flag3) { this.adminAgent = ehfWellKnownGroup3; } if (flag4) { this.helpdeskAgent = ehfWellKnownGroup4; } if (this.IsSyncRequired) { this.CacheAdminSyncState(configADAdapter); } }
public virtual ExSearchResultEntry ReadObjectEntry(Guid objectGuid, bool readDeleted, params string[] attrNames) { return(this.ReadObjectEntry(EhfADAdapter.CreateDNForObjectGuid(objectGuid), readDeleted, attrNames)); }
public virtual void SetAttributeValue(Guid objectGuid, string attrName, object value) { this.SetAttributeValue(EhfADAdapter.CreateDNForObjectGuid(objectGuid), attrName, value); }
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)); }
public EhfRecipientTargetConnection(int localServerVersion, EhfTargetServerConfig config, EdgeSyncLogSession logSession, EhfPerfCounterHandler perfCounterHandler, IAdminSyncService adminSyncservice, EhfADAdapter adapter, EnhancedTimeSpan syncInterval, EhfSynchronizationProvider provider) : base(localServerVersion, config, logSession, perfCounterHandler, null, null, adminSyncservice, adapter, syncInterval) { this.provider = provider; }
public static void ClearForceDomainSyncFlagFromPerimeterConfig(EhfADAdapter adAdapter, Guid companyGuid) { adAdapter.SetAttributeValue(companyGuid, "msExchTransportInboundSettings", 0.ToString()); }
public EhfTargetConnection(int localServerVersion, EhfTargetServerConfig config, EdgeSyncLogSession logSession, EhfPerfCounterHandler perfCounterHandler, IProvisioningService provisioningService, IManagementService managementService, IAdminSyncService adminSyncService, EhfADAdapter adapter, EnhancedTimeSpan syncInterval) : this(localServerVersion, config, syncInterval, logSession) { this.provisioningService = new EhfProvisioningService(provisioningService, managementService, adminSyncService); this.adapter = adapter; this.perfCounterHandler = perfCounterHandler; }