Ejemplo n.º 1
0
        public void Process(PipelineArgs args)
        {
            var domainName = Settings.GetSetting("DeferredRegistration.Domain");

            Assert.IsNotNullOrEmpty(domainName, "domainName");

            if (DomainManager.GetDomain(domainName) != null)
            {
                return;
            }

            using (new UserSwitcher("sitecore\\admin", true))
            {
                DomainManager.AddDomain(domainName);
            }
        }
Ejemplo n.º 2
0
        protected override void ProcessRecord()
        {
            if (DomainManager.DomainExists(Name))
            {
                WriteError(typeof(DuplicateNameException), $"Cannot create a duplicate domain with name '{Name}'.",
                           ErrorIds.DomainAlreadyExists, ErrorCategory.InvalidArgument, Name);
                return;
            }

            if (!ShouldProcess(Name, "Create domain"))
            {
                return;
            }

            DomainManager.AddDomain(Name, LocallyManaged);
            WriteObject(DomainManager.GetDomain(Name));
        }