public void Init(HttpApplication context) { if (context == null) { throw new ArgumentNullException("context"); } ExTraceGlobals.ReportingWebServiceTracer.TraceDebug((long)this.GetHashCode(), "ReportingModule.Init"); context.BeginRequest += this.OnBeginRequest; context.EndRequest += this.OnEndRequest; if (ReportingModule.NewAuthZMethodEnabled.Value && !Datacenter.IsForefrontForOfficeDatacenter()) { context.AuthorizeRequest += this.OnAuthorizeRequest; } }
private static Datacenter.ExchangeSku GetExchangeSku() { Datacenter.ExchangeSku result; try { if (Datacenter.IsForefrontForOfficeDatacenter()) { result = Datacenter.ExchangeSku.ForefrontForOfficeDatacenter; } else { result = Datacenter.GetExchangeSku(); } } catch (CannotDetermineExchangeModeException innerException) { throw new ExchangeConfigurationException(MExRuntimeStrings.FailedToReadDataCenterMode, innerException); } return(result); }
protected override void InternalValidate() { if (Server.IsSubscribedGateway(base.GlobalConfigSession)) { base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null); } base.InternalValidate(); if (this.DataObject.PendingRemoval && !this.DataObject.IsChanged(AcceptedDomainSchema.PendingRemoval)) { base.WriteError(new CannotOperateOnAcceptedDomainPendingRemovalException(this.DataObject.DomainName.ToString()), ErrorCategory.InvalidOperation, null); } if (this.DataObject.PendingRemoval && this.DataObject.IsChanged(AcceptedDomainSchema.PendingRemoval)) { RemoveAcceptedDomain.CheckDomainForRemoval(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.IsChanged(ADObjectSchema.Name)) { NewAcceptedDomain.ValidateDomainName(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain)) { this.WriteWarning(Strings.WarnAboutStarAcceptedDomain); } SetAcceptedDomain.DomainEditValidator domainEditValidator = new SetAcceptedDomain.DomainEditValidator(this); domainEditValidator.ValidateAllPolicies(); if (this.DataObject.IsChanged(AcceptedDomainSchema.AcceptedDomainType) && this.DataObject.DomainType == AcceptedDomainType.ExternalRelay && (Datacenter.IsMicrosoftHostedOnly(true) || Datacenter.IsForefrontForOfficeDatacenter())) { base.WriteError(new ExternalRelayDomainsAreNotAllowedInDatacenterAndFfoException(), ErrorCategory.InvalidOperation, null); } if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient) && this.CatchAllRecipient != null) { this.resolvedCatchAllRecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.CatchAllRecipient, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.CatchAllRecipientNotExists(this.CatchAllRecipient)), new LocalizedString?(Strings.CatchAllRecipientNotUnique(this.CatchAllRecipient)), ExchangeErrorCategory.Client); } AcceptedDomainUtility.ValidateCatchAllRecipient(this.resolvedCatchAllRecipient, this.DataObject, base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient), new Task.TaskErrorLoggingDelegate(base.WriteError)); AcceptedDomainUtility.ValidateIfOutboundConnectorToRouteDomainIsPresent(base.DataSession, this.DataObject, new Task.TaskWarningLoggingDelegate(this.WriteWarning)); if (this.DataObject.IsChanged(AcceptedDomainSchema.AcceptedDomainType) || base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains)) { bool matchSubDomains = base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains) ? this.MatchSubDomains : this.DataObject.MatchSubDomains; AcceptedDomainUtility.ValidateMatchSubDomains(matchSubDomains, this.DataObject.DomainType, new Task.TaskErrorLoggingDelegate(base.WriteError)); } }
protected override void InternalValidate() { TaskLogger.LogEnter(); if (Server.IsSubscribedGateway(base.GlobalConfigSession)) { base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null); } base.InternalValidate(); if (this.SkipDomainNameValidation) { if (!TemplateTenantConfiguration.IsTemplateTenant(base.OrganizationId)) { base.WriteError(new CannotBypassDomainNameValidationException(), ErrorCategory.InvalidOperation, null); } } else { NewAcceptedDomain.ValidateDomainName(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain)) { this.WriteWarning(Strings.WarnAboutStarAcceptedDomain); } NewAcceptedDomain.DomainAdditionValidator domainAdditionValidator = new NewAcceptedDomain.DomainAdditionValidator(this); domainAdditionValidator.ValidateAllPolicies(); if (this.DataObject.InitialDomain) { NewAcceptedDomain.ValidateInitialDomain(this.DataObject, this.ConfigurationSession, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.DomainType == AcceptedDomainType.ExternalRelay && (Datacenter.IsMicrosoftHostedOnly(true) || Datacenter.IsForefrontForOfficeDatacenter())) { base.WriteError(new ExternalRelayDomainsAreNotAllowedInDatacenterAndFfoException(), ErrorCategory.InvalidOperation, null); } if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient) && this.CatchAllRecipient != null) { this.resolvedCatchAllRecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.CatchAllRecipient, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.CatchAllRecipientNotExists(this.CatchAllRecipient)), new LocalizedString?(Strings.CatchAllRecipientNotUnique(this.CatchAllRecipient)), ExchangeErrorCategory.Client); } AcceptedDomainUtility.ValidateCatchAllRecipient(this.resolvedCatchAllRecipient, this.DataObject, base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient), new Task.TaskErrorLoggingDelegate(base.WriteError)); AcceptedDomainUtility.ValidateIfOutboundConnectorToRouteDomainIsPresent(base.DataSession, this.DataObject, new Task.TaskWarningLoggingDelegate(this.WriteWarning)); AcceptedDomainUtility.ValidateMatchSubDomains(this.DataObject.MatchSubDomains, this.DataObject.DomainType, new Task.TaskErrorLoggingDelegate(base.WriteError)); TaskLogger.LogExit(); }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); if (Datacenter.IsMultiTenancyEnabled()) { this.isMultiTenancy = true; } else { this.isMultiTenancy = false; } this.exs = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.ExSWkGuid); if (this.exs == null) { base.ThrowTerminatingError(new ExSGroupNotFoundException(WellKnownGuid.ExSWkGuid), ErrorCategory.InvalidData, null); } base.LogReadObject(this.exs); this.eoa = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EoaWkGuid); if (this.eoa == null) { base.ThrowTerminatingError(new ExOrgAdminSGroupNotFoundException(WellKnownGuid.EoaWkGuid), ErrorCategory.InvalidData, null); } base.LogReadObject(this.eoa); this.era = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EraWkGuid); if (this.era == null) { base.ThrowTerminatingError(new ExOrgReadAdminSGroupNotFoundException(WellKnownGuid.EraWkGuid), ErrorCategory.InvalidData, null); } base.LogReadObject(this.eoa); this.mas = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.MaSWkGuid); if (this.mas == null) { base.ThrowTerminatingError(new ExOrgReadAdminSGroupNotFoundException(WellKnownGuid.MaSWkGuid), ErrorCategory.InvalidData, null); } base.LogReadObject(this.mas); this.epa = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EpaWkGuid); if (this.epa != null) { base.LogReadObject(this.epa); } this.ets = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EtsWkGuid); if (this.ets == null) { base.ThrowTerminatingError(new ExTrustedSubsystemGroupNotFoundException(WellKnownGuid.EtsWkGuid), ErrorCategory.InvalidData, null); } base.LogReadObject(this.ets); this.delegatedSetupRG = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.RgDelegatedSetupWkGuid); DelegatedSetupRoleGroupValueEnum delegatedSetupRoleGroupValue = VariantConfiguration.InvariantNoFlightingSnapshot.AD.DelegatedSetupRoleGroupValue.DelegatedSetupRoleGroupValue; if (delegatedSetupRoleGroupValue == DelegatedSetupRoleGroupValueEnum.NotExists || Datacenter.IsForefrontForOfficeDatacenter()) { if (this.delegatedSetupRG != null) { base.ThrowTerminatingError(new ExRbacRoleGroupInMultiTenantException(WellKnownGuid.RgDelegatedSetupWkGuid, "Delegated Setup"), ErrorCategory.InvalidData, null); } } else if (delegatedSetupRoleGroupValue == DelegatedSetupRoleGroupValueEnum.Exists) { if (this.delegatedSetupRG == null) { base.ThrowTerminatingError(new ExRbacRoleGroupNotFoundException(WellKnownGuid.RgDelegatedSetupWkGuid, "Delegated Setup"), ErrorCategory.InvalidData, null); } base.LogReadObject(this.delegatedSetupRG); } this.autodiscoverContainer = this.ReadCriticalObjectFromRootOrg <ADContainer>(((ITopologyConfigurationSession)this.configurationSession).GetAutoDiscoverGlobalContainerId()); this.orgContainer = this.configurationSession.GetOrgContainer(); base.LogReadObject(this.orgContainer); if (Datacenter.IsMultiTenancyEnabled()) { ADObjectId configurationUnitsRootForLocalForest = ADSession.GetConfigurationUnitsRootForLocalForest(); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsObjectId(configurationUnitsRootForLocalForest), 1413, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\InitializeExchangeConfigContainer.cs"); this.confUnitsContainer = tenantConfigurationSession.Read <Container>(configurationUnitsRootForLocalForest); if (this.confUnitsContainer != null) { base.LogReadObject(this.confUnitsContainer); } } this.addressingContainer = this.ReadCriticalObject <Container>(this.orgContainer.Id.GetChildId("Addressing")); this.meServicesContainer = this.configurationSession.GetExchangeConfigurationContainer(); base.LogReadObject(this.meServicesContainer); ADObjectId childId = this.orgContainer.Id.GetChildId("Address Lists Container"); this.addressListsContainer = this.ReadCriticalObject <Container>(childId); this.offlineAddressListsContainer = this.ReadCriticalObject <Container>(childId.GetChildId("Offline Address Lists")); this.recipPoliciesContainer = this.ReadCriticalObject <RecipientPoliciesContainer>(this.orgContainer.Id.GetChildId("Recipient Policies")); this.sitesContainer = this.ReadCriticalObject <SitesContainer>(this.configurationSession.ConfigurationNamingContext.GetChildId("Sites")); this.administrativeGroup = ((ITopologyConfigurationSession)this.configurationSession).GetAdministrativeGroup(); base.LogReadObject(this.administrativeGroup); this.arraysContainer = this.ReadCriticalObject <Container>(ClientAccessArray.GetParentContainer((ITopologyConfigurationSession)this.configurationSession)); TaskLogger.LogExit(); }