public static bool CheckGroupQuotaEnabled(int packageId, string groupName, string quotaName) { // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); if (cntx == null) { return(false); } // check group if (!cntx.Groups.ContainsKey(groupName)) { return(false); } // check wildcard quota name if (!string.IsNullOrEmpty(groupName) && quotaName.Substring(groupName.Length) == ".*") { return(true); } // check quota if (cntx.Quotas.ContainsKey(quotaName)) { return(!cntx.Quotas[quotaName].QuotaExhausted); } return(false); }
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; } } }
protected void btnAdd_Click(object sender, EventArgs e) { // get domain type DomainType type = GetDomainType(Request["DomainType"]); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (type == DomainType.Domain && !cntx.Quotas[Quotas.OS_DOMAINS].QuotaExhausted) { if (CheckForCorrectIdnDomainUsage(DomainName.Text)) { AddDomain(); } } if (type == DomainType.SubDomain && !cntx.Quotas[Quotas.OS_SUBDOMAINS].QuotaExhausted) { if (CheckForCorrectIdnDomainUsage(DomainName.Text)) { AddDomain(); } } if (type == DomainType.ProviderSubDomain && !cntx.Quotas[Quotas.OS_SUBDOMAINS].QuotaExhausted) { if (CheckForCorrectIdnDomainUsage(DomainName.Text)) { AddDomain(); } } }
public static bool IsVirtualMachineManagementAllowed(int packageId) { bool manageAllowed = false; PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); if (cntx.Quotas.ContainsKey(Quotas.VPS_MANAGING_ALLOWED)) { manageAllowed = !cntx.Quotas[Quotas.VPS_MANAGING_ALLOWED].QuotaExhausted; } if (PanelSecurity.EffectiveUser.Role == UserRole.Administrator) { manageAllowed = true; } else if (PanelSecurity.EffectiveUser.Role == UserRole.Reseller) { // check if the reseller is allowed to manage on its parent level PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId); if (package.UserId != PanelSecurity.EffectiveUserId) { cntx = PackagesHelper.GetCachedPackageContext(package.ParentPackageId); if (cntx != null && cntx.Quotas.ContainsKey(Quotas.VPS_MANAGING_ALLOWED)) { manageAllowed = !cntx.Quotas[Quotas.VPS_MANAGING_ALLOWED].QuotaExhausted; } } } return(manageAllowed); }
private void BindValues() { Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); string quotaName = ""; if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) { quotaName = Quotas.CRM2013_MAXDATABASESIZE; } else if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) { quotaName = Quotas.CRM_MAXDATABASESIZE; } int limitDBSize = cntx.Quotas[quotaName].QuotaAllocatedValue; //maxStorageSettingsValue.ParentQuotaValue = limitDBSize; maxStorageSettingsValue.ParentQuotaValue = -1; long maxDBSize = ES.Services.CRM.GetMaxDBSize(PanelRequest.ItemID, PanelSecurity.PackageId); long DBSize = ES.Services.CRM.GetDBSize(PanelRequest.ItemID, PanelSecurity.PackageId); DBSize = DBSize > 0 ? DBSize = DBSize / (1024 * 1024) : DBSize; maxDBSize = maxDBSize > 0 ? maxDBSize = maxDBSize / (1024 * 1024) : maxDBSize; maxStorageSettingsValue.QuotaValue = Convert.ToInt32(maxDBSize); lblDBSize.Text = SizeValueToString(DBSize); lblMAXDBSize.Text = SizeValueToString(maxDBSize); lblLimitDBSize.Text = SizeValueToString(limitDBSize); }
protected void Page_Load(object sender, EventArgs e) { // Remove Service Level item and VIP item from Action List if current Hosting plan does not allow Service Levels if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.ServiceLevels)) { RemoveActionItem(UserActionTypes.SetServiceLevel); RemoveActionItem(UserActionTypes.SetVIP); RemoveActionItem(UserActionTypes.UnsetVIP); } if (!ShowSetMailboxPlan) { RemoveActionItem(UserActionTypes.SetMailboxPlan); } var settings = ES.Services.Organizations.GetWebDavSystemSettings(); var isSendPasswordEnabled = settings != null && Utils.ParseBool(settings[EnterpriseServer.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false); var isTwilioEnabled = ES.Services.System.CheckIsTwilioEnabled(); if (!isSendPasswordEnabled) { RemoveActionItem(UserActionTypes.SendByEmail); } if (!isTwilioEnabled) { RemoveActionItem(UserActionTypes.SendBySms); } }
public void BindQuota() { try { // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); // get quota if (cntx.Quotas.ContainsKey(QuotaName)) { QuotaValueInfo quota = cntx.Quotas[QuotaName]; quotaViewer.QuotaTypeId = quota.QuotaTypeId; quotaViewer.QuotaUsedValue = quota.QuotaUsedValue; quotaViewer.QuotaValue = quota.QuotaAllocatedValue; quotaViewer.QuotaAvailable = -1; //this.Visible = quota.QuotaAllocatedValue != 0; } else { this.Visible = false; quotaViewer.QuotaTypeId = 1; // bool quotaViewer.QuotaUsedValue = 0; quotaViewer.QuotaValue = 0; quotaViewer.QuotaAvailable = -1; } } catch { /* do nothing */ } }
private void BindQuotas() { // load package context cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); int packageId = ES.Services.Packages.GetPackage(PanelSecurity.PackageId).PackageId; lnkViewBandwidthDetails.NavigateUrl = GetNavigateBandwidthDetails(packageId); lnkViewDiskspaceDetails.NavigateUrl = GetNavigateDiskspaceDetails(packageId); }
private void Save() { try { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); string quotaName = ""; if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) { quotaName = Quotas.CRM2013_MAXDATABASESIZE; } else if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) { quotaName = Quotas.CRM_MAXDATABASESIZE; } long limitSize = cntx.Quotas[quotaName].QuotaAllocatedValue; long maxSize = maxStorageSettingsValue.QuotaValue; if (limitSize != -1) { if (maxSize == -1) { maxSize = limitSize; } if (maxSize > limitSize) { maxSize = limitSize; } } if (maxSize > 0) { maxSize = maxSize * 1024 * 1024; } ES.Services.CRM.SetMaxDBSize(PanelRequest.ItemID, PanelSecurity.PackageId, maxSize); messageBox.ShowSuccessMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); BindValues(); } catch (Exception) { messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); } }
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; } } }
protected void Page_Load(object sender, EventArgs e) { //PanelSecurity.SelectedUser.Role == UserRole.ResellerCSR || // PanelSecurity.SelectedUser.Role == UserRole.Reseller || // PanelSecurity.SelectedUser.Role == UserRole.ResellerHelpdesk || if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) { Visible = false; } if (PanelSecurity.PackageId == 0) { myPackages = new PackagesHelper().GetMyPackages(); //For selectedUser have Packages or not then HIDE Menu if (myPackages.Tables[0].Rows.Count == 0) { Visible = false; } if (Session["currentPackage"] == null || ((int)Session["currentUser"]) != PanelSecurity.SelectedUserId) { if (myPackages.Tables[0].Rows.Count > 0) { Session["currentPackage"] = myPackages.Tables[0].Rows[0][0].ToString(); Session["currentUser"] = PanelSecurity.SelectedUserId; } } currentPackage = Convert.ToInt32(Session["currentPackage"]); } else { currentPackage = PanelSecurity.PackageId; } // load package context cntx = PackagesHelper.GetCachedPackageContext(currentPackage); // bind root node MenuItem rootItem = new MenuItem(locMenuTitle.Text); rootItem.Value = "Hosting Space Menu"; rootItem.Selectable = false; menu.Items.Add(rootItem); BindMenu(rootItem.ChildItems, PortalUtils.GetModuleMenuItems(this)); }
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 int ChangeUsersServiceLevel(List <int> userIds) { if (ddlServiceLevels.SelectedItem == null) { return(0); } string levelName = ddlServiceLevels.SelectedItem.Text; if (string.IsNullOrEmpty(levelName)) { return(0); } int levelId; if (string.IsNullOrEmpty(ddlServiceLevels.SelectedItem.Value)) { return(ChangeUsersSettings(userIds, null, 0, null)); } if (!int.TryParse(ddlServiceLevels.SelectedItem.Value, out levelId)) { return(0); } string quotaName = Quotas.SERVICE_LEVELS + levelName; PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (!cntx.Quotas.ContainsKey(quotaName)) { return(0); } OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); List <OrganizationUser> users = userIds.Select(id => ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, id)).ToList(); int usersCount = users.Count - users.Count(x => x.LevelId == levelId); if (!CheckServiceLevelQuota(levelName, stats.ServiceLevels, usersCount)) { return(-1); } return(ChangeUsersSettings(userIds, null, levelId, null)); }
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); } }
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; } } } }
protected void Page_Load(object sender, EventArgs e) { domainsSelectDomainControl.PackageId = PanelSecurity.PackageId; if (!IsPostBack) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); //if (Utils.CheckQouta(Quotas.WEB_ENABLEHOSTNAMESUPPORT, cntx)) //{ txtHostName.Visible = lblTheDotInTheMiddle.Visible = true; UserSettings settings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.WEB_POLICY); txtHostName.Text = String.IsNullOrEmpty(settings["HostName"]) ? "" : settings["HostName"]; //} //else //txtHostName.Visible = lblTheDotInTheMiddle.Visible = false; } }
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 ApplyPackageContextRestrictions(int packageId) { // load context PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); bool intervalTasksAllowed = (cntx.Quotas.ContainsKey(Quotas.OS_SCHEDULEDINTERVALTASKS) && cntx.Quotas[Quotas.OS_SCHEDULEDINTERVALTASKS].QuotaAllocatedValue != 0); if (!intervalTasksAllowed) { ddlSchedule.Items.Remove(ddlSchedule.Items.FindByValue("Interval")); } // check if this an admin if (PanelSecurity.LoggedUser.Role != UserRole.Administrator) { // remove "high" priorities ddlPriority.Items.Remove(ddlPriority.Items.FindByValue("Highest")); ddlPriority.Items.Remove(ddlPriority.Items.FindByValue("AboveNormal")); ddlPriority.Items.Remove(ddlPriority.Items.FindByValue("Normal")); } }
private int EnableDns(bool enable, List <int> ids) { foreach (var id in ids) { // load domain DomainInfo domain = ES.Services.Servers.GetDomain(id); if (domain == null) { continue; } // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext(domain.PackageId); bool dnsEnabled = cntx.Groups.ContainsKey(ResourceGroups.Dns); if (!dnsEnabled) { continue; } int result; if (enable) { result = ES.Services.Servers.EnableDomainDns(id); } else { result = ES.Services.Servers.DisableDomainDns(id); } if (result < 0) { return(result); } } return(0); }
protected void FillServiceLevelsList() { if (GridView == null || String.IsNullOrWhiteSpace(CheckboxesName)) { return; } List <int> ids = Utils.GetCheckboxValuesFromGrid <int>(GridView, CheckboxesName); List <OrganizationUser> users = ids.Select(id => ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, id)).ToList(); OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) { List <ServiceLevel> enabledServiceLevels = new List <ServiceLevel>(); foreach (ServiceLevel serviceLevel in ES.Services.Organizations.GetSupportServiceLevels()) { int usersCount = users.Count - users.Count(x => (x.LevelId == serviceLevel.LevelId)); if (CheckServiceLevelQuota(serviceLevel.LevelName, stats.ServiceLevels, usersCount)) { enabledServiceLevels.Add(serviceLevel); } } ddlServiceLevels.DataSource = enabledServiceLevels; ddlServiceLevels.DataTextField = "LevelName"; ddlServiceLevels.DataValueField = "LevelId"; ddlServiceLevels.DataBind(); ddlServiceLevels.Items.Insert(0, new ListItem("<Select Service Level>", string.Empty)); ddlServiceLevels.Items.FindByValue(string.Empty).Selected = true; } }
public MenuItemCollection GetIconsDataSource(int packageId) { // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); // init collection MenuItemCollection items = new MenuItemCollection(); // get icons list foreach (XmlNode xmlNode in xmlIcons) { // create icon item MenuItem iconItem = CreateMenuItem(cntx, xmlNode); if (iconItem == null) { continue; } // add into list items.Add(iconItem); } return(items); }
public void FillDatabaseVersions(int packageId, ListItemCollection items, List <string> versions) { if (versions == null) { return; } // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); items.Clear(); AddDatabaseVersion(cntx, ResourceGroups.MsSql2000, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2005, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2008, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2012, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2014, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2016, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2017, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MsSql2019, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MySql4, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MySql5, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MySql8, items, versions); AddDatabaseVersion(cntx, ResourceGroups.MariaDB, items, versions); }
protected void Page_Load(object sender, EventArgs e) { // Remove DNS items if current Hosting plan does not allow it if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.Dns)) { RemoveActionItem(DomainActionTypes.EnableDns); RemoveActionItem(DomainActionTypes.DisableDns); } // Remove Preview Domain items if current Hosting plan does not allow it PackageSettings packageSettings = ES.Services.Packages.GetPackageSettings(PanelSecurity.PackageId, PackageSettings.INSTANT_ALIAS); if (packageSettings == null || String.IsNullOrEmpty(packageSettings["PreviewDomain"])) { RemoveActionItem(DomainActionTypes.CreatePreviewDomain); RemoveActionItem(DomainActionTypes.DeletePreviewDomain); } // hide control if no actions allowed if (ActionsList.Items.Count <= 1) { Visible = false; } }
public static bool IsQuotaEnabled(int packageId, string quotaName) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); return(cntx.Quotas.ContainsKey(quotaName) && !cntx.Quotas[quotaName].QuotaExhausted); }
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(); }
private void BindControls() { // get domain type DomainType type = GetDomainType(Request["DomainType"]); // enable domain/sub-domain fields // load package context if (type == DomainType.Domain || type == DomainType.DomainPointer) { // domains DomainName.IsSubDomain = false; } else { // sub-domains DomainName.IsSubDomain = true; // fill sub-domains if (!IsPostBack) { if (type == DomainType.SubDomain) { BindUserDomains(); } else { BindResellerDomains(); } } } if ((type == DomainType.DomainPointer || (type == DomainType.Domain)) && !IsPostBack) { // bind web sites WebSitesList.DataSource = ES.Services.WebServers.GetWebSites(PanelSecurity.PackageId, false); WebSitesList.DataBind(); } if ((type == DomainType.DomainPointer || (type == DomainType.Domain)) && !IsPostBack) { // bind mail domains MailDomainsList.DataSource = ES.Services.MailServers.GetMailDomains(PanelSecurity.PackageId, false); MailDomainsList.DataBind(); } PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); // create web site option CreateSolidCP.Visible = (type == DomainType.Domain || type == DomainType.SubDomain) && cntx.Groups.ContainsKey(ResourceGroups.Web); if (PointWebSite.Checked) { CreateWebSite.Checked = false; CreateWebSite.Enabled = false; } else { CreateWebSite.Enabled = true; CreateWebSite.Checked &= CreateSolidCP.Visible; } // point Web site PointSolidCP.Visible = (type == DomainType.DomainPointer || (type == DomainType.Domain)) && cntx.Groups.ContainsKey(ResourceGroups.Web) && WebSitesList.Items.Count > 0; WebSitesList.Enabled = PointWebSite.Checked; // point mail domain PointMailDomainPanel.Visible = (type == DomainType.DomainPointer || (type == DomainType.Domain)) && cntx.Groups.ContainsKey(ResourceGroups.Mail) && MailDomainsList.Items.Count > 0; MailDomainsList.Enabled = PointMailDomain.Checked; // DNS option EnableDnsPanel.Visible = cntx.Groups.ContainsKey(ResourceGroups.Dns); EnableDns.Checked &= EnableDnsPanel.Visible; // Preview Domain // check if Preview Domain was setup bool instantAliasAllowed = false; PackageSettings settings = ES.Services.Packages.GetPackageSettings(PanelSecurity.PackageId, PackageSettings.INSTANT_ALIAS); instantAliasAllowed = (settings != null && !String.IsNullOrEmpty(settings["PreviewDomain"])); PreviewDomainPanel.Visible = instantAliasAllowed && (type != DomainType.DomainPointer) /*&& EnableDnsPanel.Visible*/; CreatePreviewDomain.Checked &= PreviewDomainPanel.Visible; // allow sub-domains AllowSubDomainsPanel.Visible = (type == DomainType.Domain) && PanelSecurity.EffectiveUser.Role != UserRole.User; if (IsPostBack) { CheckForCorrectIdnDomainUsage(DomainName.Text); } }
public bool IsOrgPanelVisible(int packageId) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId); return(cntx.Groups.ContainsKey(ResourceGroups.HostedOrganizations)); }
private void AddDomain() { if (!Page.IsValid) { return; } // get domain type DomainType type = GetDomainType(Request["DomainType"]); // get domain name var domainName = DomainName.Text; int pointWebSiteId = 0; int pointMailDomainId = 0; // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (type == DomainType.DomainPointer || (type == DomainType.Domain)) { if (PointWebSite.Checked && WebSitesList.Items.Count > 0) { pointWebSiteId = Utils.ParseInt(WebSitesList.SelectedValue, 0); } } if (type == DomainType.DomainPointer || (type == DomainType.Domain)) { if (PointMailDomain.Checked && MailDomainsList.Items.Count > 0) { pointMailDomainId = Utils.ParseInt(MailDomainsList.SelectedValue, 0); } } // add domain int domainId = 0; try { domainId = ES.Services.Servers.AddDomainWithProvisioning(PanelSecurity.PackageId, domainName.ToLower(), type, CreateWebSite.Checked, pointWebSiteId, pointMailDomainId, EnableDns.Checked, CreatePreviewDomain.Checked, AllowSubDomains.Checked, (PointWebSite.Checked && WebSitesList.Items.Count > 0) ? string.Empty : txtHostName.Text.ToLower()); if (domainId < 0) { ShowResultMessage(domainId); return; } } catch (Exception ex) { ShowErrorMessage("DOMAIN_ADD_DOMAIN", ex); return; } // put created domain to the cookie HttpCookie domainCookie = new HttpCookie("CreatedDomainId", domainId.ToString()); Response.Cookies.Add(domainCookie); // return RedirectBack(); }
private void BindItem() { try { if (!IsPostBack) { // load item if required if (PanelRequest.ItemID > 0) { // existing item try { item = ES.Services.MailServers.GetMailAccount(PanelRequest.ItemID); } catch (Exception ex) { ShowErrorMessage("MAIL_GET_ACCOUNT", ex); return; } if (item != null) { // save package info ViewState["PackageId"] = item.PackageId; mailEditAddress.PackageId = item.PackageId; passwordControl.SetPackagePolicy(item.PackageId, UserSettings.MAIL_POLICY, "AccountPasswordPolicy"); } else { RedirectToBrowsePage(); } } else { // new item ViewState["PackageId"] = PanelSecurity.PackageId; mailEditAddress.PackageId = PanelSecurity.PackageId; passwordControl.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.MAIL_POLICY, "AccountPasswordPolicy"); } } // load provider control LoadProviderControl((int)ViewState["PackageId"], "Mail", providerControl, "EditAccount.ascx"); // load package context PackageContext cntx = PackagesHelper.GetCachedPackageContext((int)ViewState["PackageId"]); if (!IsPostBack) { // set messagebox size textbox visibility HandleMaxMailboxSizeLimitDisplay(cntx); // bind item to controls if (item != null) { // bind item to controls mailEditAddress.Email = item.Name; mailEditAddress.EditMode = true; passwordControl.EditMode = true; // Display currently set max mailbox size limit SetMaxMailboxSizeLimit(item.MaxMailboxSize); // other controls IMailEditAccountControl ctrl = (IMailEditAccountControl)providerControl.Controls[0]; ctrl.BindItem(item); } else { IMailEditAccountControl ctrl = (IMailEditAccountControl)providerControl.Controls[0]; string[] settings = ES.Services.Servers.GetMailServiceSettingsByPackage((int)ViewState["PackageId"]); StringDictionary settingsDictionary = ConvertArrayToDictionary(settings); MailAccount item = new MailAccount(); if (settingsDictionary.ContainsKey("isDomainAdminEnabled")) { item.IsDomainAdminEnabled = Convert.ToBoolean(settingsDictionary["isDomainAdminEnabled"]); } ctrl.BindItem(item); } } } catch (Exception ex) { ShowWarningMessage("INIT_SERVICE_ITEM_FORM"); DisableFormControls(this, btnCancel); return; } }
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; } }