Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lnkBackup.NavigateUrl          = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "backup");
            lnkRestore.NavigateUrl         = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "restore");
            lnkImportResources.NavigateUrl = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "import");

            lnkBackup.Visible          = lnkRestore.Visible = PortalUtils.PageExists("Backup");
            lnkImportResources.Visible = (PanelSecurity.PackageId > 1 &&
                                          PanelSecurity.LoggedUser.Role == UserRole.Administrator);

            if (PanelSecurity.SelectedUser.RoleId.Equals(1))
            {
                lnkBackup.Visible = lnkRestore.Visible = ToolsHeader.Visible;
            }


            UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);

            if (user != null)
            {
                PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
                if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, cntx)))
                {
                    lnkBackup.Visible = lnkRestore.Visible = ToolsHeader.Visible = false;
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // bind quotas
            BindQuotas();

            UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);

            if (user != null)
            {
                PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
                if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, cntx)))
                {
                    btnViewQuotas.Visible = lnkViewDiskspaceDetails.Visible = false;
                }
            }
        }
        private void BindControls()
        {
            // set navigate URLs
            DomainLink.NavigateUrl            = GetAddDomainLink("Domain");
            SubDomainLink.NavigateUrl         = GetAddDomainLink("SubDomain");
            ProviderSubDomainLink.NavigateUrl = GetAddDomainLink("ProviderSubDomain");
            DomainPointerLink.NavigateUrl     = GetAddDomainLink("DomainPointer");

            // load package context
            PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);

            DomainLink.Enabled = (cntx.Quotas.ContainsKey(Quotas.OS_DOMAINS) && !cntx.Quotas[Quotas.OS_DOMAINS].QuotaExhausted);

            if (DomainLink.Enabled)
            {
                UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);

                if (user != null)
                {
                    if (user.Role == UserRole.User)
                    {
                        DomainLink.Enabled = !Utils.CheckQouta(Quotas.OS_NOTALLOWTENANTCREATEDOMAINS, cntx);
                    }
                }
            }



            DomainInfo[] myDomains        = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId);
            bool         enableSubDomains = false;

            foreach (DomainInfo domain in myDomains)
            {
                if (!domain.IsSubDomain && !domain.IsPreviewDomain && !domain.IsDomainPointer)
                {
                    enableSubDomains = true;
                    break;
                }
            }
            SubDomainLink.Enabled = (cntx.Quotas.ContainsKey(Quotas.OS_SUBDOMAINS) && !cntx.Quotas[Quotas.OS_SUBDOMAINS].QuotaExhausted &&
                                     enableSubDomains);

            ProviderSubDomainPanel.Visible = (cntx.Quotas.ContainsKey(Quotas.OS_SUBDOMAINS) && !cntx.Quotas[Quotas.OS_SUBDOMAINS].QuotaExhausted &&
                                              ES.Services.Servers.GetResellerDomains(PanelSecurity.PackageId).Length > 0);

            DomainPointerLink.Enabled = (cntx.Quotas.ContainsKey(Quotas.OS_DOMAINPOINTERS) && !cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaExhausted);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // bind controls
                BindControls();
                DomainType     type = GetDomainType(Request["DomainType"]);
                PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
                if (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINS].QuotaExhausted)
                {
                    btnAdd.Enabled = false;
                }
                if (type == DomainType.SubDomain && cntx.Quotas[Quotas.OS_SUBDOMAINS].QuotaExhausted)
                {
                    btnAdd.Enabled = false;
                }


                if (Utils.CheckQouta(Quotas.WEB_ENABLEHOSTNAMESUPPORT, cntx))
                {
                    lblHostName.Visible = txtHostName.Visible = true;
                    UserSettings settings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.WEB_POLICY);
                    txtHostName.Text = String.IsNullOrEmpty(settings["HostName"]) ? "" : settings["HostName"];
                }
                else
                {
                    lblHostName.Visible = txtHostName.Visible = false;
                    txtHostName.Text    = "";
                }

                if ((PanelSecurity.LoggedUser.Role == UserRole.User) & (type != DomainType.SubDomain))
                {
                    if (cntx.Groups.ContainsKey(ResourceGroups.Dns))
                    {
                        if (!PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Dns, Quotas.DNS_EDITOR))
                        {
                            this.DisableControls = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("DOMAIN_GET_DOMAIN", ex);
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindSpace();

                UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);

                if (user != null)
                {
                    PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
                    if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, cntx)))
                    {
                        lnkSummaryLetter.Visible = false;
                    }
                }
            }
        }
Beispiel #6
0
        private void ToggleControls()
        {
            PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);

            rowDedicatedIP.Visible = rbDedicatedIP.Checked;

            if (Utils.CheckQouta(Quotas.WEB_ENABLEHOSTNAMESUPPORT, cntx))
            {
                txtHostName.Visible = chkIgnoreGlobalDNSRecords.Visible = lblIgnoreGlobalDNSRecords.Visible = lblTheDotInTheMiddle.Visible = true;
                UserSettings settings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.WEB_POLICY);
                txtHostName.Text = String.IsNullOrEmpty(settings["HostName"]) ? "" : settings["HostName"];
                chkIgnoreGlobalDNSRecords.Checked = false;
            }
            else
            {
                txtHostName.Visible = chkIgnoreGlobalDNSRecords.Visible = lblIgnoreGlobalDNSRecords.Visible = lblTheDotInTheMiddle.Visible = false;
                chkIgnoreGlobalDNSRecords.Checked = true;
                txtHostName.Text = "";
                domainsSelectDomainControl.HideWebSites = true;
            }
        }
        private void BindDomain()
        {
            try
            {
                // load domain
                DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
                if (domain == null)
                {
                    RedirectToBrowsePage();
                }


                // load package context
                PackageContext cntx = PackagesHelper.GetCachedPackageContext(domain.PackageId);

                DomainName.Text = domain.DomainName;

                bool webEnabled  = cntx.Groups.ContainsKey(ResourceGroups.Web);
                bool mailEnabled = cntx.Groups.ContainsKey(ResourceGroups.Mail);
                bool dnsEnabled  = cntx.Groups.ContainsKey(ResourceGroups.Dns);

                // web site
                if (webEnabled && domain.WebSiteId > 0)
                {
                    SolidCP.Visible           = true;
                    WebSiteAliasPanel.Visible = true;

                    WebSiteName.Text            = domain.WebSiteName;
                    WebSiteParkedPanel.Visible  = (String.Compare(domain.WebSiteName, domain.DomainName, true) == 0);
                    WebSitePointedPanel.Visible = !WebSiteParkedPanel.Visible;

                    BrowseWebSite.NavigateUrl = "http://" + domain.DomainName;
                }

                // mail domain
                if (mailEnabled && domain.MailDomainId > 0)
                {
                    MailDomainPanel.Visible      = true;
                    MailDomainAliasPanel.Visible = true;

                    MailDomainName.Text          = domain.MailDomainName;
                    MailEnabledPanel.Visible     = (String.Compare(domain.MailDomainName, domain.DomainName, true) == 0);
                    PointMailDomainPanel.Visible = !MailEnabledPanel.Visible;
                }

                // DNS
                if (dnsEnabled)
                {
                    DnsPanel.Visible         = true;
                    DnsEnabledPanel.Visible  = (domain.ZoneItemId > 0);
                    DnsDisabledPanel.Visible = !DnsEnabledPanel.Visible;

                    // dns editor
                    EditDnsRecords.Visible = (cntx.Quotas.ContainsKey(Quotas.DNS_EDITOR) &&
                                              cntx.Quotas[Quotas.DNS_EDITOR].QuotaAllocatedValue != 0) ||
                                             PanelSecurity.LoggedUser.Role == UserRole.Administrator;

                    //DNS Export
                    ExportDnsRecords.Visible = (cntx.Quotas.ContainsKey(Quotas.DNS_EDITOR) &&
                                                cntx.Quotas[Quotas.DNS_EDITOR].QuotaAllocatedValue != 0) ||
                                               PanelSecurity.LoggedUser.Role == UserRole.Administrator;

                    //DNS Import
                    ImportDnsRecords.Visible = (cntx.Quotas.ContainsKey(Quotas.DNS_EDITOR) &&
                                                cntx.Quotas[Quotas.DNS_EDITOR].QuotaAllocatedValue != 0) ||
                                               PanelSecurity.LoggedUser.Role == UserRole.Administrator;
                }

                // Preview Domain
                PackageSettings settings = ES.Services.Packages.GetPackageSettings(PanelSecurity.PackageId, PackageSettings.INSTANT_ALIAS);

                bool instantAliasAllowed = !String.IsNullOrEmpty(domain.PreviewDomainName);
                bool instantAliasExists  = (domain.PreviewDomainId > 0) && (settings != null && !String.IsNullOrEmpty(settings["PreviewDomain"]));
                if (instantAliasAllowed &&
                    !domain.IsDomainPointer && !domain.IsPreviewDomain)
                {
                    PreviewDomainPanel.Visible    = true;
                    PreviewDomainEnabled.Visible  = instantAliasExists;
                    PreviewDomainDisabled.Visible = !instantAliasExists;

                    // load Preview Domain
                    DomainInfo instantAlias = ES.Services.Servers.GetDomain(domain.PreviewDomainId);
                    WebSiteAliasPanel.Visible = false;
                    if (instantAlias != null)
                    {
                        DomainInfo[] Domains = ES.Services.Servers.GetDomainsByDomainId(domain.PreviewDomainId);
                        foreach (DomainInfo d in Domains)
                        {
                            if (d.WebSiteId > 0)
                            {
                                WebSiteAliasPanel.Visible = true;
                            }
                        }

                        MailDomainAliasPanel.Visible = (instantAlias.MailDomainId > 0);
                    }

                    // Preview Domain
                    PreviewDomainName.Text = domain.PreviewDomainName;

                    // web site alias
                    WebSiteAlias.Text = WebSiteAlias.NavigateUrl = "http://" + domain.PreviewDomainName;

                    // mail domain alias
                    MailDomainAlias.Text = "@" + domain.PreviewDomainName;
                }

                // resellers
                AllowSubDomains.Checked = domain.HostingAllowed;
                if (PanelSecurity.EffectiveUser.Role != UserRole.User &&
                    !(domain.IsDomainPointer || domain.IsSubDomain || domain.IsPreviewDomain))
                {
                    ResellersPanel.Visible = true;
                }

                if (!(domain.IsDomainPointer || domain.IsSubDomain || domain.IsPreviewDomain))
                {
                    UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);

                    if (user != null)
                    {
                        if (user.Role == UserRole.User)
                        {
                            btnDelete.Enabled = !Utils.CheckQouta(Quotas.OS_NOTALLOWTENANTCREATEDOMAINS, cntx);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("DOMAIN_GET_DOMAIN", ex);
                return;
            }
        }
        private void BindWebSite()
        {
            WebSite site = null;

            try
            {
                site = ES.Services.WebServers.GetWebSite(PanelRequest.ItemID);
            }
            catch (Exception ex)
            {
                ShowErrorMessage("WEB_GET_SITE", ex);
                return;
            }

            if (site == null)
            {
                RedirectToBrowsePage();
            }

            // IIS 7.0 mode
            IIs7 = site.IIs7;



            PackageId = site.PackageId;

            // bind site
            lnkSiteName.Text        = site.Name;
            lnkSiteName.NavigateUrl = "http://" + site.Name;

            // bind unassigned IP addresses
            ddlIpAddresses.Items.Clear();
            PackageIPAddress[] ips = ES.Services.Servers.GetPackageUnassignedIPAddresses(site.PackageId, 0, IPAddressPool.WebSites);
            foreach (PackageIPAddress ip in ips)
            {
                string fullIP = ip.ExternalIP;
                if (ip.InternalIP != null &&
                    ip.InternalIP != "" &&
                    ip.InternalIP != ip.ExternalIP)
                {
                    fullIP += " (" + ip.InternalIP + ")";
                }

                ddlIpAddresses.Items.Add(new ListItem(fullIP, ip.PackageAddressID.ToString()));
            }

            if (site.IsDedicatedIP)
            {
                litIPAddress.Text = site.SiteIPAddress;
            }
            else
            {
                //The line below was not showing the correct Public Shared IP Address for websites.
                //lblSharedIP.Text = string.Format("({0})", ipsGeneral[0].ExternalIP);
                StringDictionary settings = ConvertArrayToDictionary(ES.Services.Servers.GetServiceSettingsRDS(site.ServiceId));
                if (settings["PublicSharedIP"] != null)
                {
                    lblSharedIP.Text = settings["PublicSharedIP"].ToString();
                }
            }

            dedicatedIP.Visible = site.IsDedicatedIP;
            sharedIP.Visible    = !site.IsDedicatedIP;

            PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);

            if (Utils.CheckQouta(Quotas.WEB_ALLOWIPADDRESSMODESWITCH, cntx))
            {
                cmdSwitchToDedicatedIP.Visible = (ddlIpAddresses.Items.Count > 0);
            }
            else
            {
                cmdSwitchToDedicatedIP.Visible = cmdSwitchToSharedIP.Visible = false;
            }

            litFrontPageUnavailable.Visible = false;
            tblSharePoint.Visible           = site.SharePointInstalled;
            tblFrontPage.Visible            = !site.SharePointInstalled;


            if (!site.ColdFusionAvailable)
            {
                litCFUnavailable.Text    = GetLocalizedString("Text.COLDFUSION_UNAVAILABLE");
                litCFUnavailable.Visible = true;
                rowCF.Visible            = false;
                rowVirtDir.Visible       = false;
            }
            else
            {
                if (site.ColdFusionVersion.Equals("7"))
                {
                    litCFUnavailable.Text    = "ColdFusion 7.x is installed";
                    litCFUnavailable.Visible = true;
                }
                else if (site.ColdFusionVersion.Equals("8"))
                {
                    litCFUnavailable.Text    = "ColdFusion 8.x is installed";
                    litCFUnavailable.Visible = true;
                }
                else if (site.ColdFusionVersion.Equals("9"))
                {
                    litCFUnavailable.Text    = "ColdFusion 9.x is installed";
                    litCFUnavailable.Visible = true;
                }
                else if (site.ColdFusionVersion.Equals("10"))
                {
                    litCFUnavailable.Text    = "ColdFusion 10.x is installed";
                    litCFUnavailable.Visible = true;
                }
                else if (site.ColdFusionVersion.Equals("11"))
                {
                    litCFUnavailable.Text    = "ColdFusion 11.x is installed";
                    litCFUnavailable.Visible = true;
                }
                else if (site.ColdFusionVersion.Equals("2016"))
                {
                    litCFUnavailable.Text    = "ColdFusion 2016.x is installed";
                    litCFUnavailable.Visible = true;
                }
            }

            if (!PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_CFVIRTUALDIRS))
            {
                //virtual directories are not implemented for IIS 7
                rowVirtDir.Visible = false;
            }

            chkCfExt.Checked   = site.ColdFusionInstalled;
            chkVirtDir.Checked = site.CreateCFAppVirtualDirectories;



            // bind FrontPage
            if (!site.FrontPageAvailable)
            {
                litFrontPageUnavailable.Text    = GetLocalizedString("Text.FPSE_UNAVAILABLE");
                litFrontPageUnavailable.Visible = true;
                tblFrontPage.Visible            = false;
            }
            else
            {
                // set control policies
                frontPageUsername.SetPackagePolicy(site.PackageId, UserSettings.WEB_POLICY, "FrontPageAccountPolicy");
                frontPagePassword.SetPackagePolicy(site.PackageId, UserSettings.WEB_POLICY, "FrontPagePasswordPolicy");

                // set default account name
                VirtualDirectoriesCol.Visible = false;
                frontPageUsername.Text        = site.FrontPageAccount;
                ToggleFrontPageControls(site.FrontPageInstalled);
            }


            AppPoolRestartPanel.Visible = Utils.CheckQouta(Quotas.WEB_APPPOOLSRESTART, cntx);

            // bind controls
            webSitesHomeFolderControl.BindWebItem(PackageId, site);
            webSitesSecuredFoldersControl.BindSecuredFolders(site);
            webSitesHeliconApeControl.BindHeliconApe(site);
            webSitesExtensionsControl.BindWebItem(PackageId, site);
            webSitesMimeTypesControl.BindWebItem(site);
            webSitesCustomHeadersControl.BindWebItem(site);
            webSitesCustomErrorsControl.BindWebItem(site);

            // If SNI is enabled on the server, we do allow for SSL even if site not has dedicated Ip
            if (site.IsDedicatedIP || site.SniEnabled)
            {
                AllowSsl = true;
                WebsitesSSLControl.Visible = true;
                WebsitesSSLControl.BindWebItem(site);
            }
            else
            {
                AllowSsl = false;
                WebsitesSSLControl.Visible = false;
            }

            BindVirtualDirectories();
            BindAppVirtualDirectories();

            // bind state
            BindSiteState(site.SiteState);
            // AppPool
            AppPoolState appPoolState = ES.Services.WebServers.GetAppPoolState(PanelRequest.ItemID);

            BindAppPoolState(appPoolState);

            // bind pointers
            BindPointers();

            // save packageid
            ViewState["PackageID"] = site.PackageId;

            //
            ToggleWmSvcControls(site);

            //
            if (!site.GetValue <bool>(WebAppVirtualDirectory.WmSvcSiteEnabled))
            {
                txtWmSvcAccountName.Text = AutoSuggestWmSvcAccontName(site, "_admin");
            }

            ToggleWmSvcConnectionHint(site);

            // Web Deploy Publishing
            ToggleWebDeployPublishingControls(site);
            BindWebPublishingProfileDatabases();
            BindWebPublishingProfileDatabaseUsers();
            BindWebPublishingProfileFtpAccounts(site);

            // bind tabs
            BindTabs();
        }
Beispiel #9
0
        private void BindHostingPlan()
        {
            // plan resources
            int planId = Utils.ParseInt(ddlPlans.SelectedValue, 0);

            chkCreateResources.Visible = (planId > 0);
            bool createResources = chkCreateResources.Checked;

            ResourcesPanel.Visible = createResources & chkCreateResources.Visible;
            if (!createResources)
            {
                return;
            }

            if ((PanelSecurity.LoggedUser.Role == UserRole.ResellerCSR) |
                (PanelSecurity.LoggedUser.Role == UserRole.ResellerHelpdesk))
            {
                this.chkCreateResources.Enabled = this.chkIntegratedOUProvisioning.Enabled = false;
            }


            bool systemEnabled       = false;
            bool webEnabled          = false;
            bool ftpEnabled          = false;
            bool mailEnabled         = false;
            bool integratedOUEnabled = false;

            // load hosting context
            if (planId > 0)
            {
                HostingPlanContext cntx = PackagesHelper.GetCachedHostingPlanContext(planId);

                if (cntx != null)
                {
                    chkRedirectToCreateVPS.Checked = chkRedirectToCreateVPS.Visible = cntx.Groups.ContainsKey(ResourceGroups.VPS2012);
                    systemEnabled = cntx.Groups.ContainsKey(ResourceGroups.Os);
                    webEnabled    = cntx.Groups.ContainsKey(ResourceGroups.Web);

                    if (Utils.CheckQouta(Quotas.WEB_ENABLEHOSTNAMESUPPORT, cntx))
                    {
                        lblHostName.Visible = txtHostName.Visible = true;
                        UserSettings settings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.WEB_POLICY);
                        txtHostName.Text = String.IsNullOrEmpty(settings["HostName"]) ? "" : settings["HostName"];
                    }
                    else
                    {
                        lblHostName.Visible = txtHostName.Visible = false;
                        txtHostName.Text    = "";
                    }

                    ftpEnabled  = cntx.Groups.ContainsKey(ResourceGroups.Ftp);
                    mailEnabled = cntx.Groups.ContainsKey(ResourceGroups.Mail);

                    if (Utils.CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx))
                    {
                        integratedOUEnabled = true;
                    }
                }
            }

            // toggle group controls
            fsSystem.Visible = systemEnabled;

            fsWeb.Visible             = webEnabled;
            chkCreateWebSite.Checked &= webEnabled;


            fsFtp.Visible = ftpEnabled;
            chkCreateFtpAccount.Checked &= ftpEnabled;

            fsMail.Visible = mailEnabled;
            chkCreateMailAccount.Checked &= mailEnabled;

            ftpAccountName.Visible = (rbFtpAccountName.SelectedIndex == 1);

            chkIntegratedOUProvisioning.Checked = chkIntegratedOUProvisioning.Visible = (chkCreateResources.Visible && integratedOUEnabled);
        }