private string GetPackagePolicy(string settingsName, string key)
        {
            // load package
            PackageInfo package = PackagesHelper.GetCachedPackage(PanelSecurity.PackageId);

            if (package != null)
            {
                // load user profile
                int userId = package.UserId;
                _policyUser = UsersHelper.GetCachedUser(package.UserId);

                if (_policyUser != null)
                {
                    // load settings
                    UserSettings settings = UsersHelper.GetCachedUserSettings(userId, settingsName);
                    if (settings != null)
                    {
                        string policyValue = settings[key];
                        if (policyValue != null)
                        {
                            return(policyValue);
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 2
0
        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 */
            }
        }
        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();
                }
            }
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
        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);
        }
Esempio n. 8
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;
                }
            }
        }
        private void BindTabs()
        {
            List <Tab> tabsList = new List <Tab>();

            tabsList.Add(new Tab(0, "home", GetLocalizedString("Tab.HomeFolder")));
            tabsList.Add(new Tab(1, "extensions", GetLocalizedString("Tab.Extensions")));
            if (PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_ERRORS))
            {
                tabsList.Add(new Tab(2, "errors", GetLocalizedString("Tab.CustomErrors")));
            }
            if (PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_HEADERS))
            {
                tabsList.Add(new Tab(3, "headers", GetLocalizedString("Tab.CustomHeaders")));
            }
            if (PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_MIME))
            {
                tabsList.Add(new Tab(4, "mime", GetLocalizedString("Tab.MIMETypes")));
            }

            if (dlTabs.SelectedIndex == -1)
            {
                dlTabs.SelectedIndex = 0;
            }

            dlTabs.DataSource = tabsList.ToArray();
            dlTabs.DataBind();

            tabs.ActiveViewIndex = tabsList[dlTabs.SelectedIndex].Index;
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        public void SetPackagePolicy(int packageId, string settingsName, string key)
        {
            // load package
            PackageInfo package = PackagesHelper.GetCachedPackage(packageId);

            if (package != null)
            {
                // init by user
                SetUserPolicy(package.UserId, settingsName, key);
            }
        }
Esempio n. 12
0
        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");
            }
        }
Esempio n. 13
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;
                }
            }
        }
        public void BindWebItem(int packageId, WebVirtualDirectory item)
        {
            fileLookup.PackageId    = item.PackageId;
            fileLookup.SelectedFile = item.ContentPath;

            string resSuffix = item.IIs7 ? "IIS7" : "";

            chkAuthAnonymous.Checked = item.EnableAnonymousAccess;
            chkAuthWindows.Checked   = item.EnableWindowsAuthentication;
            chkAuthBasic.Checked     = item.EnableBasicAuthentication;

            // toggle controls by quotas
            fileLookup.Enabled = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_HOMEFOLDERS);

            UserSettings settings = ES.Services.Users.GetUserSettings(PanelSecurity.SelectedUserId, "WebPolicy");
        }
        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);
        }
Esempio n. 16
0
        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));
        }
Esempio n. 17
0
        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));
        }
        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);
            }
        }
Esempio n. 19
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;
                    }
                }
            }
        }
Esempio n. 20
0
        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;
            }
        }
Esempio n. 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ClientScriptManager cs = Page.ClientScript;

            cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js"));

            dnsRecords = new Dictionary <int, string>();

            gvDomains.PageSize = UsersHelper.GetDisplayItemsPerPage();

            // SE Check
            bool SEEnable = false;

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["SpamExpertsEnable"]))
            {
                SEEnable = true;
            }

            // visibility
            chkRecursive.Visible         = (PanelSecurity.SelectedUser.Role != UserRole.User);
            gvDomains.Columns[5].Visible = gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
            gvDomains.Columns[7].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
            gvDomains.Columns[8].Visible = SEEnable;
            gvDomains.Columns[9].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);

            if (!IsPostBack)
            {
                // toggle controls
                btnAddDomain.Enabled = PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Os, Quotas.OS_DOMAINS) ||
                                       PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Os, Quotas.OS_SUBDOMAINS) ||
                                       PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Os, Quotas.OS_DOMAINPOINTERS);

                searchBox.AddCriteria("DomainName", GetLocalizedString("SearchField.DomainName"));
                if ((PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked)
                {
                    searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username"));
                    searchBox.AddCriteria("FullName", GetLocalizedString("SearchField.FullName"));
                    searchBox.AddCriteria("Email", GetLocalizedString("SearchField.Email"));
                }
            }
            searchBox.AjaxData = GetSearchBoxAjaxData();
        }
Esempio n. 22
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;
            }
        }
Esempio n. 23
0
        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);
        }
Esempio n. 24
0
        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"));
            }
        }
Esempio n. 25
0
        private void BindTabs()
        {
            Tab[] tabsArray = new Tab[]
            {
                new Tab(GetLocalizedString("Tab.HomeFolder"), true),
                new Tab(GetLocalizedString("Tab.Extensions"), true),
                new Tab(GetLocalizedString("Tab.CustomErrors"),
                        PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_ERRORS)),
                new Tab(GetLocalizedString("Tab.CustomHeaders"),
                        PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_HEADERS)),
                new Tab(GetLocalizedString("Tab.MIMETypes"),
                        PackagesHelper.CheckGroupQuotaEnabled(PackageId, ResourceGroups.Web, Quotas.WEB_MIME))
            };

            if (dlTabs.SelectedIndex == -1)
            {
                dlTabs.SelectedIndex = 0;
            }

            dlTabs.DataSource = tabsArray;
            dlTabs.DataBind();

            tabs.ActiveViewIndex = dlTabs.SelectedIndex;
        }
Esempio n. 26
0
        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);
        }
Esempio n. 27
0
        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;
            }
        }
Esempio n. 28
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;
            }
        }
Esempio n. 29
0
        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);
        }
        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);
            }
        }