internal string GetAccountOrResourceForestFqdn() { if (this.PartitionId != null && !ADSessionSettings.IsForefrontObject(this.PartitionId)) { return(this.PartitionId.ForestFQDN); } return(TopologyProvider.LocalForestFqdn); }
private ADSessionSettings(ScopeSet scopeSet, ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, ConfigScopes configScopes, PartitionId partitionId) { if (scopeSet == null) { throw new ArgumentNullException("scopeSet"); } if (null == currentOrganizationId) { throw new ArgumentNullException("currentOrganizationId"); } if (executingUserOrganizationId != null && !executingUserOrganizationId.Equals(OrganizationId.ForestWideOrgId) && !executingUserOrganizationId.Equals(currentOrganizationId) && !currentOrganizationId.OrganizationalUnit.IsDescendantOf(executingUserOrganizationId.OrganizationalUnit)) { throw new ArgumentException(DirectoryStrings.ErrorInvalidExecutingOrg(executingUserOrganizationId.OrganizationalUnit.DistinguishedName, currentOrganizationId.OrganizationalUnit.DistinguishedName)); } if (partitionId == null) { throw new ArgumentNullException("partitionId"); } this.scopeSet = scopeSet; this.preferredServers = new SimpleServerSettings(); this.rootOrgId = rootOrgId; this.currentOrganizationId = currentOrganizationId; this.executingUserOrganizationId = executingUserOrganizationId; this.configScopes = configScopes; this.partitionId = partitionId; this.tenantConsistencyMode = ((configScopes == ConfigScopes.AllTenants) ? TenantConsistencyMode.IgnoreRetiredTenants : TenantConsistencyMode.ExpectOnlyLiveTenants); if (!ADGlobalConfigSettings.SoftLinkEnabled || this.PartitionId == null || this.PartitionId.IsLocalForestPartition() || ADSessionSettings.IsForefrontObject(this.PartitionId)) { this.PartitionSoftLinkMode = SoftLinkMode.Disabled; return; } if (this.PartitionId.ForestFQDN.EndsWith(TopologyProvider.LocalForestFqdn, StringComparison.OrdinalIgnoreCase)) { this.PartitionSoftLinkMode = SoftLinkMode.Disabled; return; } if (this.ConfigScopes == ConfigScopes.Database || this.ConfigScopes == ConfigScopes.Server || this.ConfigScopes == ConfigScopes.RootOrg) { this.PartitionSoftLinkMode = SoftLinkMode.Disabled; return; } this.PartitionSoftLinkMode = SoftLinkMode.DualMatch; }
internal static bool IsTenantConfigObjectInCorrectNC(ADObjectId tenantObjectId) { return(tenantObjectId == null || tenantObjectId.DomainId == null || ADSessionSettings.IsForefrontObject(tenantObjectId) || tenantObjectId.ToDNString().IndexOf("cn=configuration,dc=", StringComparison.OrdinalIgnoreCase) < 0 || !ADSession.IsTenantConfigInDomainNC(tenantObjectId.GetPartitionId().ForestFQDN)); }