protected override void InternalProcessRecord() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); Guid guid = Guid.Empty; if (base.Fields.IsModified("ExternalDirectoryOrganizationId")) { guid = (Guid)base.Fields["ExternalDirectoryOrganizationId"]; GlobalLocatorServiceTenant globalLocatorServiceTenant; if (!glsDirectorySession.TryGetTenantInfoByOrgGuid(guid, out globalLocatorServiceTenant)) { base.WriteGlsTenantNotFoundError(guid); } } else { SmtpDomain smtpDomain = (SmtpDomain)base.Fields["DomainName"]; GlobalLocatorServiceTenant globalLocatorServiceTenant; if (!glsDirectorySession.TryGetTenantInfoByDomain(smtpDomain.Domain, out globalLocatorServiceTenant)) { base.WriteGlsDomainNotFoundError(smtpDomain.Domain); } guid = globalLocatorServiceTenant.ExternalDirectoryOrganizationId; } glsDirectorySession.RemoveTenant(guid); }
internal static bool TryGlsLookupByExternalDirectoryOrganizationId(Guid externalDirectoryOrganizationId, out string resourceForestFqdn, out string accountForestFqdn, out string tenantContainerCN, out Exception exception) { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); resourceForestFqdn = null; accountForestFqdn = null; tenantContainerCN = null; bool result = false; try { result = glsDirectorySession.TryGetTenantForestsByOrgGuid(externalDirectoryOrganizationId, out resourceForestFqdn, out accountForestFqdn, out tenantContainerCN); exception = null; } catch (GlsTransientException ex) { exception = ex; } catch (GlsTenantNotFoundException ex2) { exception = ex2; } catch (GlsPermanentException ex3) { exception = ex3; } return(result); }
protected override void InternalProcessRecord() { GlobalLocatorServiceTenant globalLocatorServiceTenant = new GlobalLocatorServiceTenant(); GlobalLocatorServiceTenant oldGlsTenant = new GlobalLocatorServiceTenant(); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); if (base.Fields.IsModified("ExternalDirectoryOrganizationId")) { Guid guid = (Guid)base.Fields["ExternalDirectoryOrganizationId"]; if (!glsDirectorySession.TryGetTenantInfoByOrgGuid(guid, out oldGlsTenant)) { base.WriteGlsTenantNotFoundError(guid); } } else { SmtpDomain smtpDomain = (SmtpDomain)base.Fields["DomainName"]; if (!glsDirectorySession.TryGetTenantInfoByDomain(smtpDomain.Domain, out oldGlsTenant)) { base.WriteGlsDomainNotFoundError(smtpDomain.Domain); } } globalLocatorServiceTenant = this.GetUpdatedGLSTenant(oldGlsTenant); glsDirectorySession.UpdateTenant(globalLocatorServiceTenant.ExternalDirectoryOrganizationId, globalLocatorServiceTenant.ResourceForest, globalLocatorServiceTenant.AccountForest, globalLocatorServiceTenant.SmtpNextHopDomain.Domain, globalLocatorServiceTenant.TenantFlags, globalLocatorServiceTenant.TenantContainerCN, globalLocatorServiceTenant.PrimarySite); }
protected override void InternalProcessRecord() { GlobalLocatorServiceTenant globalLocatorServiceTenant = new GlobalLocatorServiceTenant(); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); globalLocatorServiceTenant.ExternalDirectoryOrganizationId = (Guid)base.Fields["ExternalDirectoryOrganizationId"]; globalLocatorServiceTenant.ResourceForest = (string)base.Fields["ResourceForest"]; PartitionId partitionId; Exception ex; if (!PartitionId.TryParse(globalLocatorServiceTenant.ResourceForest, out partitionId, out ex)) { base.WriteInvalidFqdnError(globalLocatorServiceTenant.ResourceForest); } globalLocatorServiceTenant.AccountForest = (string)base.Fields["AccountForest"]; if (!PartitionId.TryParse(globalLocatorServiceTenant.AccountForest, out partitionId, out ex)) { base.WriteInvalidFqdnError(globalLocatorServiceTenant.AccountForest); } globalLocatorServiceTenant.PrimarySite = (string)base.Fields["PrimarySite"]; globalLocatorServiceTenant.SmtpNextHopDomain = (SmtpDomain)base.Fields["SmtpNextHopDomain"]; globalLocatorServiceTenant.TenantContainerCN = (string)base.Fields["TenantContainerCN"]; if (base.Fields.IsModified("TenantFlags")) { globalLocatorServiceTenant.TenantFlags = (GlsTenantFlags)base.Fields["TenantFlags"]; } glsDirectorySession.AddTenant(globalLocatorServiceTenant.ExternalDirectoryOrganizationId, globalLocatorServiceTenant.ResourceForest, globalLocatorServiceTenant.AccountForest, globalLocatorServiceTenant.SmtpNextHopDomain.Domain, globalLocatorServiceTenant.TenantFlags, globalLocatorServiceTenant.TenantContainerCN, globalLocatorServiceTenant.PrimarySite); base.WriteObject(globalLocatorServiceTenant); }
private string GetRedirectServerFromMemberName(string memberName, out bool alreadyInTheRightForest, bool throwExceptionsOnTenantNotFound) { string address = string.Format("E5CB63F56E8B4b69A1F70C192276D6AD@{0}", GlsDirectorySession.ParseMemberName(memberName).Domain); int partnerId = MServDirectorySession.ReadMservEntry(address); return(this.GetRedirectServerFromPartnerId(partnerId, out alreadyInTheRightForest, throwExceptionsOnTenantNotFound)); }
protected override void InternalProcessRecord() { GlobalLocatorServiceDomain globalLocatorServiceDomain = new GlobalLocatorServiceDomain(); List <KeyValuePair <DomainProperty, PropertyValue> > list = new List <KeyValuePair <DomainProperty, PropertyValue> >(); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); BitVector32 bitVector = default(BitVector32); bitVector[1] = false; globalLocatorServiceDomain.ExternalDirectoryOrganizationId = (Guid)base.Fields["ExternalDirectoryOrganizationId"]; globalLocatorServiceDomain.DomainName = (SmtpDomain)base.Fields["DomainName"]; globalLocatorServiceDomain.DomainInUse = (base.Fields.IsModified("DomainInUse") && (bool)base.Fields["DomainInUse"]); list.Add(new KeyValuePair <DomainProperty, PropertyValue>(DomainProperty.ExoDomainInUse, new PropertyValue(globalLocatorServiceDomain.DomainInUse))); if (base.Fields.IsModified("DomainFlags")) { globalLocatorServiceDomain.DomainFlags = new GlsDomainFlags?((GlsDomainFlags)base.Fields["DomainFlags"]); if ((globalLocatorServiceDomain.DomainFlags & GlsDomainFlags.Nego2Enabled) == GlsDomainFlags.Nego2Enabled) { bitVector[1] = true; } if ((globalLocatorServiceDomain.DomainFlags & GlsDomainFlags.OAuth2ClientProfileEnabled) == GlsDomainFlags.OAuth2ClientProfileEnabled) { bitVector[2] = true; } } list.Add(new KeyValuePair <DomainProperty, PropertyValue>(DomainProperty.ExoFlags, new PropertyValue(bitVector.Data))); glsDirectorySession.AddAcceptedDomain(globalLocatorServiceDomain.ExternalDirectoryOrganizationId, globalLocatorServiceDomain.DomainName.Domain, (DomainKeyType)base.Fields["DomainType"], list.ToArray()); base.WriteObject(globalLocatorServiceDomain); }
protected override void InternalProcessRecord() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); GlobalLocatorServiceMsaUser globalLocatorServiceMsaUser = new GlobalLocatorServiceMsaUser { MsaUserNetId = this.MsaUserNetId }; string text = globalLocatorServiceMsaUser.MsaUserNetId.ToString(); string address = null; Guid externalDirectoryOrganizationId; string resourceForest; string accountForest; string tenantContainerCN; if (!glsDirectorySession.TryGetTenantForestsByMSAUserNetID(text, out externalDirectoryOrganizationId, out resourceForest, out accountForest, out tenantContainerCN) || !glsDirectorySession.TryGetMSAUserMemberName(text, out address)) { base.WriteGlsMsaUserNotFoundError(text); } globalLocatorServiceMsaUser.MsaUserMemberName = SmtpAddress.Parse(address); globalLocatorServiceMsaUser.ExternalDirectoryOrganizationId = externalDirectoryOrganizationId; globalLocatorServiceMsaUser.ResourceForest = resourceForest; globalLocatorServiceMsaUser.AccountForest = accountForest; globalLocatorServiceMsaUser.TenantContainerCN = tenantContainerCN; base.WriteObject(globalLocatorServiceMsaUser); }
private void RevertGlsAccountForestToSource(string sourceForest) { if (!ADSessionSettings.IsGlsDisabled) { Guid externalDirectoryOrganizationId = new Guid(this.DataObject.ExternalDirectoryOrganizationId); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); glsDirectorySession.SetAccountForest(externalDirectoryOrganizationId, sourceForest, this.DataObject.OrganizationId.OrganizationalUnit.Name); } }
protected override void InternalValidate() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); string text = this.MsaUserNetId.ToString(); if (!glsDirectorySession.MSAUserExists(text)) { base.WriteGlsMsaUserNotFoundError(text); } base.InternalValidate(); }
protected override void InternalProcessRecord() { GlobalLocatorServiceDomain globalLocatorServiceDomain = new GlobalLocatorServiceDomain(); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); SmtpDomain smtpDomain = (SmtpDomain)base.Fields["DomainName"]; if (!glsDirectorySession.TryGetTenantDomainFromDomainFqdn(smtpDomain.Domain, out globalLocatorServiceDomain, true)) { base.WriteGlsDomainNotFoundError(smtpDomain.Domain); } glsDirectorySession.RemoveAcceptedDomain(globalLocatorServiceDomain.ExternalDirectoryOrganizationId, smtpDomain.Domain, true); }
protected override void InternalProcessRecord() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); GlobalLocatorServiceMsaUser globalLocatorServiceMsaUser = new GlobalLocatorServiceMsaUser { ExternalDirectoryOrganizationId = this.ExternalDirectoryOrganizationId, MsaUserMemberName = this.MsaUserMemberName, MsaUserNetId = this.MsaUserNetId }; glsDirectorySession.AddMSAUser(globalLocatorServiceMsaUser.MsaUserNetId.ToString(), globalLocatorServiceMsaUser.MsaUserMemberName.ToString(), globalLocatorServiceMsaUser.ExternalDirectoryOrganizationId); base.WriteObject(globalLocatorServiceMsaUser); }
protected override void InternalProcessRecord() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); GlobalLocatorServiceMsaUser globalLocatorServiceMsaUser = new GlobalLocatorServiceMsaUser { MsaUserNetId = this.MsaUserNetId, ExternalDirectoryOrganizationId = (base.Fields.IsModified("ExternalDirectoryOrganizationId") ? base.ExternalDirectoryOrganizationId : this.currentGlsMsaUser.ExternalDirectoryOrganizationId), MsaUserMemberName = (base.Fields.IsModified("MsaUserMemberName") ? this.MsaUserMemberName : this.currentGlsMsaUser.MsaUserMemberName) }; glsDirectorySession.UpdateMSAUser(globalLocatorServiceMsaUser.MsaUserNetId.ToString(), globalLocatorServiceMsaUser.MsaUserMemberName.ToString(), globalLocatorServiceMsaUser.ExternalDirectoryOrganizationId); base.WriteObject(globalLocatorServiceMsaUser); }
protected override void InternalProcessRecord() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); GlobalLocatorServiceTenant globalLocatorServiceTenant; if (base.Fields.IsModified("ExternalDirectoryOrganizationId")) { Guid guid = (Guid)base.Fields["ExternalDirectoryOrganizationId"]; if (this.UseOfflineGLS) { if (!glsDirectorySession.TryGetTenantInfoByOrgGuid(guid, out globalLocatorServiceTenant, GlsCacheServiceMode.CacheOnly)) { base.WriteGlsTenantNotFoundError(guid); } } else if (!glsDirectorySession.TryGetTenantInfoByOrgGuid(guid, out globalLocatorServiceTenant)) { base.WriteGlsTenantNotFoundError(guid); } if (this.ShowDomainNames) { globalLocatorServiceTenant.DomainNames = this.GetDomainNames(globalLocatorServiceTenant.ExternalDirectoryOrganizationId, glsDirectorySession, globalLocatorServiceTenant.AccountForest); } } else { SmtpDomain smtpDomain = (SmtpDomain)base.Fields["DomainName"]; if (this.UseOfflineGLS) { if (!glsDirectorySession.TryGetTenantInfoByDomain(smtpDomain.Domain, out globalLocatorServiceTenant, GlsCacheServiceMode.CacheOnly)) { base.WriteGlsTenantNotFoundError(smtpDomain.Domain); } } else if (!glsDirectorySession.TryGetTenantInfoByDomain(smtpDomain.Domain, out globalLocatorServiceTenant)) { base.WriteGlsTenantNotFoundError(smtpDomain.Domain); } if (this.ShowDomainNames) { globalLocatorServiceTenant.DomainNames = this.GetDomainNames(globalLocatorServiceTenant.ExternalDirectoryOrganizationId, glsDirectorySession, globalLocatorServiceTenant.AccountForest, smtpDomain.Domain); } } base.WriteObject(globalLocatorServiceTenant); }
protected override void InternalValidate() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); string text = this.MsaUserNetId.ToString(); if (glsDirectorySession.MSAUserExists(text)) { base.WriteGlsMsaUserAlreadyExistsError(text); } Guid externalDirectoryOrganizationId = this.ExternalDirectoryOrganizationId; GlobalLocatorServiceTenant globalLocatorServiceTenant; if (!glsDirectorySession.TryGetTenantInfoByOrgGuid(externalDirectoryOrganizationId, out globalLocatorServiceTenant)) { base.WriteGlsTenantNotFoundError(externalDirectoryOrganizationId); } base.InternalValidate(); }
private MultiValuedProperty <string> GetDomainNames(Guid orgGuid, GlsDirectorySession glsSession, string accountPartitionFqdn, string glsDomainName) { MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>(); AcceptedDomain[] acceptedDomainsInOrg = this.GetAcceptedDomainsInOrg(orgGuid, accountPartitionFqdn); bool flag = false; GlobalLocatorServiceDomain globalLocatorServiceDomain; if (acceptedDomainsInOrg != null) { foreach (AcceptedDomain acceptedDomain in acceptedDomainsInOrg) { if (!string.IsNullOrEmpty(glsDomainName) && acceptedDomain.Name.Equals(glsDomainName, StringComparison.OrdinalIgnoreCase)) { multiValuedProperty.Add(string.Format("{0}:{1}", acceptedDomain.Name, "ADAndGLS")); flag = true; } else if (this.UseOfflineGLS) { if (!glsSession.TryGetTenantDomainFromDomainFqdn(acceptedDomain.Name, out globalLocatorServiceDomain, GlsCacheServiceMode.CacheOnly)) { multiValuedProperty.Add(string.Format("{0}:{1}", acceptedDomain.Name, "ADOnly")); } else { multiValuedProperty.Add(string.Format("{0}:{1}", acceptedDomain.Name, "ADAndGLS")); } } else if (!glsSession.TryGetTenantDomainFromDomainFqdn(acceptedDomain.Name, out globalLocatorServiceDomain)) { multiValuedProperty.Add(string.Format("{0}:{1}", acceptedDomain.Name, "ADOnly")); } else { multiValuedProperty.Add(string.Format("{0}:{1}", acceptedDomain.Name, "ADAndGLS")); } } } if (!flag && !string.IsNullOrEmpty(glsDomainName) && glsSession.TryGetTenantDomainFromDomainFqdn(glsDomainName, out globalLocatorServiceDomain)) { multiValuedProperty.Add(string.Format("{0}:{1}", glsDomainName, "GlsOnly")); } return(multiValuedProperty); }
protected override void InternalProcessRecord() { GlobalLocatorServiceDomain sendToPipeline = new GlobalLocatorServiceDomain(); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); SmtpDomain smtpDomain = (SmtpDomain)base.Fields["DomainName"]; if (this.UseOfflineGLS) { if (!glsDirectorySession.TryGetTenantDomainFromDomainFqdn(smtpDomain.Domain, out sendToPipeline, true, GlsCacheServiceMode.CacheOnly)) { base.WriteGlsDomainNotFoundError(smtpDomain.Domain); } } else if (!glsDirectorySession.TryGetTenantDomainFromDomainFqdn(smtpDomain.Domain, out sendToPipeline, true)) { base.WriteGlsDomainNotFoundError(smtpDomain.Domain); } base.WriteObject(sendToPipeline); }
// Token: 0x06000328 RID: 808 RVA: 0x00011284 File Offset: 0x0000F484 private static TenantPartitionCacheItem SearchForTenantInfoByUserNetID(string userNetID, PartitionId partitionId) { GlsDirectorySession.ThrowIfInvalidNetID(userNetID, "userNetID"); if (partitionId == null) { throw new ArgumentNullException("partitionId"); } ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsPartitionId(partitionId); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 711, "SearchForTenantInfoByUserNetID", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADAccountPartitionLocator.cs"); ExchangeConfigurationUnit exchangeConfigurationUnitByUserNetID = tenantConfigurationSession.GetExchangeConfigurationUnitByUserNetID(userNetID); if (exchangeConfigurationUnitByUserNetID != null) { string externalDirectoryOrganizationId = exchangeConfigurationUnitByUserNetID.ExternalDirectoryOrganizationId; string name = exchangeConfigurationUnitByUserNetID.Id.Parent.Name; ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByUserNetID() found organization in partition {0}.", partitionId.ForestFQDN); return(new TenantPartitionCacheItem((partitionId.PartitionObjectId != null) ? partitionId.PartitionObjectId.Value : Guid.Empty, partitionId.ForestFQDN, PartitionId.LocalForest.ForestFQDN, new Guid(externalDirectoryOrganizationId), name, false)); } return(null); }
protected override void InternalValidate() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); if (!base.Fields.IsModified("ExternalDirectoryOrganizationId") && !base.Fields.IsModified("MsaUserMemberName")) { base.WriteError(new TaskArgumentException(Strings.ErrorNoPropertyWasModified), ExchangeErrorCategory.Client, null); } if (base.Fields.IsModified("ExternalDirectoryOrganizationId")) { Guid externalDirectoryOrganizationId = base.ExternalDirectoryOrganizationId; GlobalLocatorServiceTenant globalLocatorServiceTenant; if (!glsDirectorySession.TryGetTenantInfoByOrgGuid(externalDirectoryOrganizationId, out globalLocatorServiceTenant)) { base.WriteGlsTenantNotFoundError(externalDirectoryOrganizationId); } } this.currentGlsMsaUser = new GlobalLocatorServiceMsaUser { MsaUserNetId = this.MsaUserNetId }; string address = null; string text = this.MsaUserNetId.ToString(); Guid externalDirectoryOrganizationId2; string resourceForest; string accountForest; string tenantContainerCN; if (!glsDirectorySession.TryGetTenantForestsByMSAUserNetID(text, out externalDirectoryOrganizationId2, out resourceForest, out accountForest, out tenantContainerCN) || !glsDirectorySession.TryGetMSAUserMemberName(text, out address)) { base.WriteGlsMsaUserNotFoundError(text); } this.currentGlsMsaUser.MsaUserMemberName = SmtpAddress.Parse(address); this.currentGlsMsaUser.ExternalDirectoryOrganizationId = externalDirectoryOrganizationId2; this.currentGlsMsaUser.ResourceForest = resourceForest; this.currentGlsMsaUser.AccountForest = accountForest; this.currentGlsMsaUser.TenantContainerCN = tenantContainerCN; base.InternalValidate(); }
protected override void InternalProcessRecord() { GlobalLocatorServiceDomain globalLocatorServiceDomain = new GlobalLocatorServiceDomain(); GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); SmtpDomain smtpDomain = (SmtpDomain)base.Fields["DomainName"]; if (!glsDirectorySession.TryGetTenantDomainFromDomainFqdn(smtpDomain.Domain, out globalLocatorServiceDomain, true)) { base.WriteGlsDomainNotFoundError(smtpDomain.Domain); } List <KeyValuePair <DomainProperty, PropertyValue> > list = new List <KeyValuePair <DomainProperty, PropertyValue> >(); if (base.Fields.IsModified("DomainInUse")) { list.Add(new KeyValuePair <DomainProperty, PropertyValue>(DomainProperty.ExoDomainInUse, new PropertyValue((bool)base.Fields["DomainInUse"]))); } if (base.Fields.IsModified("DomainFlags")) { list.Add(new KeyValuePair <DomainProperty, PropertyValue>(DomainProperty.ExoFlags, new PropertyValue((int)base.Fields["DomainFlags"]))); } glsDirectorySession.UpdateAcceptedDomain(globalLocatorServiceDomain.ExternalDirectoryOrganizationId, globalLocatorServiceDomain.DomainName.Domain, list.ToArray()); }
private MultiValuedProperty <string> GetDomainNames(Guid orgGuid, GlsDirectorySession glsSession, string accountPartitionFqdn) { return(this.GetDomainNames(orgGuid, glsSession, accountPartitionFqdn, string.Empty)); }
protected override void InternalProcessRecord() { GlsDirectorySession glsDirectorySession = new GlsDirectorySession(); glsDirectorySession.RemoveMSAUser(this.MsaUserNetId.ToString()); }