protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); this.CheckForDuplicateExistingDomain(); AcceptedDomain acceptedDomain = new AcceptedDomain(); acceptedDomain.Name = this.Name; acceptedDomain.DomainName = new SmtpDomainWithSubdomains(this.DomainName, false); acceptedDomain.DomainType = this.DomainType; acceptedDomain.SetId(base.Session, this.DomainName.ToString()); acceptedDomain.OrganizationId = base.CurrentOrganizationId; NewAcceptedDomain.ValidateDomainName(acceptedDomain, new Task.TaskErrorLoggingDelegate(this.WriteWrappedError)); if (!this.DomainOwnershipVerified && this.AuthenticationType == AuthenticationType.Federated) { bool flag = false; AcceptedDomainIdParameter acceptedDomainIdParameter = AcceptedDomainIdParameter.Parse("*"); IEnumerable <AcceptedDomain> objects = acceptedDomainIdParameter.GetObjects <AcceptedDomain>(this.TenantCU.Id, base.Session); foreach (AcceptedDomain acceptedDomain2 in objects) { SmtpDomainWithSubdomains smtpDomainWithSubdomains = new SmtpDomainWithSubdomains(acceptedDomain2.DomainName.Domain.ToString(), true); if (smtpDomainWithSubdomains.Match(this.DomainName.ToString()) == acceptedDomain2.DomainName.Domain.Length) { flag = true; break; } } if (!flag) { base.WriteError(new OrganizationTaskException(Strings.ErrorTenantAdminsCanOnlyAddSubdomains(this.DomainName.ToString())), ErrorCategory.InvalidOperation, null); } } TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (this.CreateSharedConfiguration && !this.shouldCreateSCT) { return; } if (this.ProgramId.IndexOf(".") != -1 || this.OfferId.IndexOf(".") != -1) { base.WriteError(new ArgumentException(Strings.ErrorParametersCannotHaveEmbeddedDot), ErrorCategory.InvalidArgument, null); } this.CheckForDuplicateExistingOrganization(); NewAcceptedDomain.ValidateDomainName(new AcceptedDomain { DomainName = new SmtpDomainWithSubdomains(this.DomainName, false), DomainType = AcceptedDomainType.Authoritative }, new Task.TaskErrorLoggingDelegate(this.WriteWrappedError)); bool flag = this.ServicePlanConfig.IsTemplateTenantServicePlan(this.servicePlanSettings); bool flag2 = TemplateTenantConfiguration.IsTemplateTenantName(this.Name); if (flag) { if (this.partition != PartitionId.LocalForest) { this.WriteWarning(Strings.ErrorLocalAccountPartitionRequiredForTT); } if (!this.CreateSharedConfiguration) { base.WriteError(new ArgumentException(Strings.CreateSharedConfigurationRequiredForTT), ErrorCategory.InvalidArgument, null); } if (!flag2) { base.WriteError(new ArgumentException(Strings.CalculatedNameRequiredForTT(TemplateTenantConfiguration.TopLevelDomain)), ErrorCategory.InvalidArgument, null); } } else if (flag2) { base.WriteError(new ArgumentException(Strings.TTNameWithNonTTServiceplan(TemplateTenantConfiguration.TopLevelDomain)), ErrorCategory.InvalidArgument, null); } TaskLogger.LogExit(); }