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;
        }
Пример #2
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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public static bool IsVirtualMachineManagementAllowed(int packageId)
        {
            bool           manageAllowed = false;
            PackageContext cntx          = PackagesHelper.GetCachedPackageContext(packageId);

            if (cntx.Quotas.ContainsKey(Quotas.VPSForPC_MANAGING_ALLOWED))
            {
                manageAllowed = !cntx.Quotas[Quotas.VPSForPC_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.VPSForPC_MANAGING_ALLOWED))
                    {
                        manageAllowed = !cntx.Quotas[Quotas.VPSForPC_MANAGING_ALLOWED].QuotaExhausted;
                    }
                }
            }
            return(manageAllowed);
        }
Пример #5
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();

            // 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 = (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 = this.GetSearchBoxAjaxData();
        }
        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);
        }
Пример #7
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;
                }
            }
        }
Пример #8
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 */
            }
        }
        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);

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

            foreach (DomainInfo domain in myDomains)
            {
                if (!domain.IsSubDomain && !domain.IsInstantAlias && !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);
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // load package context
            cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);

            // bind root node
            BindMenu(menu.Items, PortalUtils.GetModuleMenuItems(this));
        }
Пример #11
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);
        }
Пример #12
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);
            }
        }
        public void BindWebItem(int packageId, WebVirtualDirectory item)
        {
            fileLookup.PackageId    = item.PackageId;
            fileLookup.SelectedFile = item.ContentPath;

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

            chkRedirectExactUrl.Text       = GetLocalizedString("chkRedirectExactUrl.Text" + resSuffix);
            chkRedirectDirectoryBelow.Text = GetLocalizedString("chkRedirectDirectoryBelow.Text" + resSuffix);
            chkRedirectPermanent.Text      = GetLocalizedString("chkRedirectPermanent.Text" + resSuffix);

            chkRedirectExactUrl.Checked       = item.RedirectExactUrl;
            chkRedirectDirectoryBelow.Checked = item.RedirectDirectoryBelow;
            chkRedirectPermanent.Checked      = item.RedirectPermanent;

            chkDirectoryBrowsing.Checked = item.EnableDirectoryBrowsing;
            chkParentPaths.Checked       = item.EnableParentPaths;
            chkWrite.Checked             = item.EnableWritePermissions;

            chkDedicatedPool.Checked = item.DedicatedApplicationPool;
            chkDedicatedPool.Enabled = !item.SharePointInstalled;

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

            // default documents
            txtDefaultDocs.Text = String.Join("\n", item.DefaultDocs.Split(',', ';'));

            // redirection
            txtRedirectUrl.Text = item.HttpRedirect;
            bool redirectionEnabled = !String.IsNullOrEmpty(item.HttpRedirect);

            rbLocationFolder.Checked   = !redirectionEnabled;
            rbLocationRedirect.Checked = redirectionEnabled;
            valRedirection.Enabled     = redirectionEnabled;

            // store app pool value
            ViewState["ApplicationPool"] = item.ApplicationPool;

            ToggleLocationControls();

            // toggle controls by quotas
            fileLookup.Enabled         = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_HOMEFOLDERS);
            rbLocationRedirect.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_REDIRECTIONS);
            bool customSecurity = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_SECURITY);

            chkWrite.Visible = customSecurity;
            // hide authentication options if not allowed
            pnlCustomAuth.Visible = customSecurity;
            //
            chkDedicatedPool.Visible    = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_APPPOOLS);
            pnlDefaultDocuments.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_DEFAULTDOCS);
        }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // load package context
            cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);

            // bind root node
            MenuItem rootItem = new MenuItem(locMenuTitle.Text);

            rootItem.Selectable = false;

            menu.Items.Add(rootItem);

            BindMenu(rootItem.ChildItems, PortalUtils.GetModuleMenuItems(this));
        }
Пример #15
0
        private void ShortcutRedirect()
        {
            if (PanelSecurity.EffectiveUser.Role == UserRole.Administrator)
            {
                return; // not for administrators
            }
            string shortcut = Request["shortcut"];

            if ("vps".Equals(shortcut, StringComparison.InvariantCultureIgnoreCase))
            {
                // load hosting spaces
                PackageInfo[] packages = ES.Services.Packages.GetMyPackages(PanelSecurity.EffectiveUserId);
                if (packages.Length == 0)
                {
                    return; // no spaces - exit
                }
                // check if some package has VPS resource enabled
                foreach (PackageInfo package in packages)
                {
                    int            packageId = package.PackageId;
                    PackageContext cntx      = PackagesHelper.GetCachedPackageContext(packageId);
                    if (cntx.Groups.ContainsKey(ResourceGroups.VPS))
                    {
                        // VPS resource found
                        // check created VPS
                        VirtualMachineMetaItemsPaged vms = ES.Services.VPS.GetVirtualMachines(packageId, "", "", "", 0, Int32.MaxValue, false);
                        if (vms.Items.Length == 1)
                        {
                            // one VPS - redirect to its properties screen
                            Response.Redirect(PortalUtils.NavigatePageURL("SpaceVPS", "SpaceID", packageId.ToString(),
                                                                          "ItemID=" + vms.Items[0].ItemID.ToString(), "ctl=vps_general", "moduleDefId=VPS"));
                        }
                        else
                        {
                            // several VPS - redirect to VPS list page
                            Response.Redirect(PortalUtils.NavigatePageURL("SpaceVPS", "SpaceID", packageId.ToString(),
                                                                          "ctl=", "moduleDefId=VPS"));
                        }
                    }
                }

                // no VPS resources found
                // redirect to space home
                if (packages.Length == 1)
                {
                    Response.Redirect(PortalUtils.GetSpaceHomePageUrl(packages[0].PackageId));
                }
            }
        }
Пример #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 (!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);
            }


            List <OrganizationUser> users = new List <OrganizationUser>();

            foreach (int id in userIds)
            {
                users.Add(ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, id));
            }


            int usersCount = users.Count - users.Where(x => (x.LevelId == levelId)).Count();

            if (!CheckServiceLevelQuota(cntx.Quotas[quotaName], usersCount))
            {
                return(-1);
            }

            return(ChangeUsersSettings(userIds, null, levelId, null));
        }
Пример #17
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);
            }
        }
        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");
            }
        }
Пример #19
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;
                }
            }
        }
Пример #20
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));
        }
Пример #21
0
        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.IsInstantAlias && !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);
        }
Пример #22
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;
            }


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

            // load hosting context
            if (planId > 0)
            {
                HostingPlanContext cntx = PackagesHelper.GetCachedHostingPlanContext(planId);
                if (cntx != null)
                {
                    systemEnabled = cntx.Groups.ContainsKey(ResourceGroups.Os);
                    webEnabled    = cntx.Groups.ContainsKey(ResourceGroups.Web);
                    ftpEnabled    = cntx.Groups.ContainsKey(ResourceGroups.Ftp);
                    mailEnabled   = cntx.Groups.ContainsKey(ResourceGroups.Mail);
                }
            }

            // 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);
        }
Пример #23
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.MySql4, items, versions);
            AddDatabaseVersion(cntx, ResourceGroups.MySql5, items, versions);
        }
        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;
            }
        }
Пример #25
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;
                    }
                }
            }
        }
Пример #26
0
        protected void FillServiceLevelsList()
        {
            if (GridView == null || String.IsNullOrWhiteSpace(CheckboxesName))
            {
                return;
            }

            List <int> ids = Utils.GetCheckboxValuesFromGrid <int>(GridView, CheckboxesName);
            List <OrganizationUser> users = new List <OrganizationUser>();

            foreach (int id in ids)
            {
                users.Add(ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, id));
            }

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

            if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
            {
                List <ServiceLevel> enabledServiceLevels = new List <ServiceLevel>();

                foreach (var quota in cntx.Quotas.Where(x => x.Key.Contains(Quotas.SERVICE_LEVELS)))
                {
                    foreach (ServiceLevel serviceLevel in ES.Services.Organizations.GetSupportServiceLevels())
                    {
                        int usersCount = users.Count - users.Where(x => (x.LevelId == serviceLevel.LevelId)).Count();

                        if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value, 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;
            }
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // bind controls
                BindControls();

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

                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    = "";
                }

                DomainType type = GetDomainType(Request["DomainType"]);

                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);
            }
        }
Пример #28
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);
        }
Пример #29
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 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"));
            }
        }