From 06f98076c61540943f48a12a15c6fa248a9240fd Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 15 Apr 2014 06:15:27 +0300 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9CGroups=E2=80=9D=20link=20users?= =?UTF-8?q?=20displaying=20quota=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HostedSolution/OrganizationController.cs | 21 +++++++++++++++ .../HostedSolution/OrganizationStatistics.cs | 15 +++++++++++ .../ExchangeServer/OrganizationHome.ascx | 8 ++++++ .../ExchangeServer/OrganizationHome.ascx.cs | 18 +++++++++++-- .../OrganizationHome.ascx.designer.cs | 27 +++++++++++++++++++ 5 files changed, 87 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index d5bf6d75..9a7f4eb1 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -924,6 +924,13 @@ namespace WebsitePanel.EnterpriseServer PackageContext cntxTmp = PackageController.GetPackageContext(org.PackageId); + if (cntxTmp.Quotas.ContainsKey(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT) && + (cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaAllocatedValue == 1 && + cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaTypeId == 1)) + { + stats.CreatedGroups = GetOrganizationSecurityGroupsPaged(org.Id, string.Empty, string.Empty, string.Empty, 0, int.MaxValue).RecordsCount; + } + if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedSharePoint)) { SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, org.Id, string.Empty, string.Empty, string.Empty, 0, 0); @@ -989,6 +996,13 @@ namespace WebsitePanel.EnterpriseServer PackageContext cntxTmp = PackageController.GetPackageContext(org.PackageId); + if (cntxTmp.Quotas.ContainsKey(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT) && + (cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaAllocatedValue == 1 && + cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaTypeId == 1)) + { + stats.CreatedGroups = GetOrganizationSecurityGroupsPaged(org.Id, string.Empty, string.Empty, string.Empty, 0, int.MaxValue).RecordsCount; + } + if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedSharePoint)) { SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, o.Id, string.Empty, string.Empty, string.Empty, 0, 0); @@ -1039,6 +1053,13 @@ namespace WebsitePanel.EnterpriseServer stats.AllocatedUsers = cntx.Quotas[Quotas.ORGANIZATION_USERS].QuotaAllocatedValue; stats.AllocatedDomains = cntx.Quotas[Quotas.ORGANIZATION_DOMAINS].QuotaAllocatedValue; + if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT) && + (cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaAllocatedValue == 1 && + cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaTypeId == 1)) + { + stats.AllocatedGroups = -1; + } + if (cntx.Groups.ContainsKey(ResourceGroups.HostedSharePoint)) { stats.AllocatedSharePointSiteCollections = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_SITES].QuotaAllocatedValue; diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs index b107d59a..8ea3a553 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs @@ -33,6 +33,9 @@ namespace WebsitePanel.Providers.HostedSolution private int allocatedUsers; private int createdUsers; + private int allocatedGroups; + private int createdGroups; + private int allocatedDomains; private int createdDomains; @@ -266,6 +269,18 @@ namespace WebsitePanel.Providers.HostedSolution get { return usedEnterpriseStorageSpace; } set { usedEnterpriseStorageSpace = value; } } + + public int AllocatedGroups + { + get { return allocatedGroups; } + set { allocatedGroups = value; } + } + + public int CreatedGroups + { + get { return createdGroups; } + set { createdGroups = value; } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index e1e87870..009d1294 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -65,6 +65,14 @@ + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs index c353096f..265648c0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -158,13 +158,27 @@ namespace WebsitePanel.Portal.ExchangeServer userStats.QuotaValue = orgStats.AllocatedUsers; if (orgStats.AllocatedUsers != -1) userStats.QuotaAvailable = tenantStats.AllocatedUsers - tenantStats.CreatedUsers; - - lnkDomains.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "domains", "SpaceID=" + PanelSecurity.PackageId); lnkUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "users", "SpaceID=" + PanelSecurity.PackageId); + + if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx)) + { + securGroupsStat.Visible = true; + + groupStats.QuotaUsedValue = orgStats.CreatedGroups; + groupStats.QuotaValue = orgStats.AllocatedGroups; + if (orgStats.AllocatedUsers != -1) groupStats.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups; + + lnkGroups.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "secur_groups", + "SpaceID=" + PanelSecurity.PackageId); + } + else + { + securGroupsStat.Visible = false; + } } else organizationStatsPanel.Visible = false; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs index cf4e3354..3833030f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs @@ -138,6 +138,33 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.QuotaViewer userStats; + /// + /// securGroupsStat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow securGroupsStat; + + /// + /// lnkGroups control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkGroups; + + /// + /// groupStats control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer groupStats; + /// /// exchangeStatsPanel control. ///