diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql
index 520a5841..fea5387e 100644
--- a/WebsitePanel/Database/update_db.sql
+++ b/WebsitePanel/Database/update_db.sql
@@ -1670,11 +1670,11 @@ END
GO
--add SecurityGroupManagement Quota
-IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedSolution.SecurityGroupManagement')
-BEGIN
-INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (423, 13, 5, N'HostedSolution.SecurityGroupManagement', N'Allow Security Group Management', 1, 0, NULL, NULL)
-END
-GO
+--IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedSolution.SecurityGroupManagement')
+--BEGIN
+--INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (423, 13, 5, N'HostedSolution.SecurityGroupManagement', N'Allow Security Group Management', 1, 0, NULL, NULL)
+--END
+--GO
-- Lync Enterprise Voice
@@ -3204,4 +3204,188 @@ VALUES
SET @FolderID = SCOPE_IDENTITY()
RETURN
+GO
+
+-- Security Groups Quota update
+
+UPDATE [dbo].[Quotas]
+SET [QuotaDescription] = N'Security Groups',
+ [QuotaName] = N'HostedSolution.SecurityGroups',
+ [QuotaTypeID] = 2
+WHERE [QuotaID] = 423
+GO
+
+UPDATE [dbo].[HostingPlanQuotas]
+SET [QuotaValue] = -1
+WHERE [QuotaID] = 423
+GO
+
+UPDATE [dbo].[PackageQuotas]
+SET [QuotaValue] = -1
+WHERE [QuotaID] = 423
+GO
+
+
+
+IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationStatistics')
+DROP PROCEDURE [dbo].[GetOrganizationStatistics]
+GO
+
+CREATE PROCEDURE [dbo].[GetOrganizationStatistics]
+(
+ @ItemID int
+)
+AS
+SELECT
+ (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 7 OR AccountType = 1 OR AccountType = 6 OR AccountType = 5) AND ItemID = @ItemID) AS CreatedUsers,
+ (SELECT COUNT(*) FROM ExchangeOrganizationDomains WHERE ItemID = @ItemID) AS CreatedDomains,
+ (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 8 OR AccountType = 9) AND ItemID = @ItemID) AS CreatedGroups
+RETURN
+GO
+
+
+ALTER FUNCTION [dbo].[CalculateQuotaUsage]
+(
+ @PackageID int,
+ @QuotaID int
+)
+RETURNS int
+AS
+ BEGIN
+
+ DECLARE @QuotaTypeID int
+ SELECT @QuotaTypeID = QuotaTypeID FROM Quotas
+ WHERE QuotaID = @QuotaID
+
+ IF @QuotaTypeID <> 2
+ RETURN 0
+
+ DECLARE @Result int
+
+ IF @QuotaID = 52 -- diskspace
+ SET @Result = dbo.CalculatePackageDiskspace(@PackageID)
+ ELSE IF @QuotaID = 51 -- bandwidth
+ SET @Result = dbo.CalculatePackageBandwidth(@PackageID)
+ ELSE IF @QuotaID = 53 -- domains
+ SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
+ INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
+ WHERE IsSubDomain = 0 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 54 -- sub-domains
+ SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
+ INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
+ WHERE IsSubDomain = 1 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 220 -- domain pointers
+ SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
+ INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
+ WHERE IsDomainPointer = 1 AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 71 -- scheduled tasks
+ SET @Result = (SELECT COUNT(S.ScheduleID) FROM PackagesTreeCache AS PT
+ INNER JOIN Schedule AS S ON S.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 305 -- RAM of VPS
+ SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
+ INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
+ INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
+ WHERE SIP.PropertyName = 'RamSize' AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 306 -- HDD of VPS
+ SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
+ INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
+ INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
+ WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 309 -- External IP addresses of VPS
+ SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
+ INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
+ INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3)
+ ELSE IF @QuotaID = 100 -- Dedicated Web IP addresses
+ SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
+ INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
+ INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 2)
+ ELSE IF @QuotaID = 350 -- RAM of VPSforPc
+ SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
+ INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
+ INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
+ WHERE SIP.PropertyName = 'Memory' AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 351 -- HDD of VPSforPc
+ SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
+ INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
+ INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
+ WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 354 -- External IP addresses of VPSforPc
+ SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
+ INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
+ INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3)
+ ELSE IF @QuotaID = 319 -- BB Users
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea
+ INNER JOIN BlackBerryUsers bu ON ea.AccountID = bu.AccountID
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 320 -- OCS Users
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea
+ INNER JOIN OCSUsers ocs ON ea.AccountID = ocs.AccountID
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 206 -- HostedSolution.Users
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (1,5,6,7))
+ ELSE IF @QuotaID = 78 -- Exchange2007.Mailboxes
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID
+ AND ea.AccountType IN (1)
+ AND ea.MailboxPlanId IS NOT NULL)
+ ELSE IF @QuotaID = 77 -- Exchange2007.DiskSpace
+ SET @Result = (SELECT SUM(B.MailboxSizeMB) FROM ExchangeAccounts AS ea
+ INNER JOIN ExchangeMailboxPlans AS B ON ea.MailboxPlanId = B.MailboxPlanId
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 370 -- Lync.Users
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
+ INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 376 -- Lync.EVUsers
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
+ INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID
+ INNER JOIN LyncUserPlans lp ON lu.LyncUserPlanId = lp.LyncUserPlanId
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID AND lp.EnterpriseVoice = 1)
+ ELSE IF @QuotaID = 381 -- Dedicated Lync Phone Numbers
+ SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
+ INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
+ INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 5)
+ ELSE IF @QuotaID = 430 -- Enterprise Storage
+ SET @Result = (SELECT SUM(ESF.FolderQuota) FROM EnterpriseFolders AS ESF
+ INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID
+ INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 431 -- Enterprise Storage Folders
+ SET @Result = (SELECT COUNT(ESF.EnterpriseFolderID) FROM EnterpriseFolders AS ESF
+ INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID
+ INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
+ WHERE PT.ParentPackageID = @PackageID)
+ ELSE IF @QuotaID = 423 -- HostedSolution.SecurityGroups
+ SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
+ INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
+ INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
+ WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (8,9))
+ ELSE
+ SET @Result = (SELECT COUNT(SI.ItemID) FROM Quotas AS Q
+ INNER JOIN ServiceItems AS SI ON SI.ItemTypeID = Q.ItemTypeID
+ INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID AND PT.ParentPackageID = @PackageID
+ WHERE Q.QuotaID = @QuotaID)
+
+ RETURN @Result
+ END
GO
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs
index 35dc110f..7e3627ea 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs
@@ -155,7 +155,8 @@ order by rg.groupOrder
public const string ORGANIZATION_USERS = "HostedSolution.Users";
public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains";
public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN";
- public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement";
+ //public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement";
+ public const string ORGANIZATION_SECURITYGROUPS = "HostedSolution.SecurityGroups";
public const string CRM_USERS = "HostedCRM.Users";
public const string CRM_ORGANIZATION = "HostedCRM.Organization";
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
index 9a7f4eb1..ddeb5cf7 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
@@ -921,16 +921,10 @@ namespace WebsitePanel.EnterpriseServer
stats.CreatedUsers = tempStats.CreatedUsers;
stats.CreatedDomains = tempStats.CreatedDomains;
+ stats.CreatedGroups = tempStats.CreatedGroups;
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);
@@ -993,16 +987,10 @@ namespace WebsitePanel.EnterpriseServer
stats.CreatedUsers += tempStats.CreatedUsers;
stats.CreatedDomains += tempStats.CreatedDomains;
+ stats.CreatedGroups += tempStats.CreatedGroups;
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);
@@ -1052,13 +1040,7 @@ namespace WebsitePanel.EnterpriseServer
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
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;
- }
+ stats.AllocatedGroups = cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPS].QuotaAllocatedValue;
if (cntx.Groups.ContainsKey(ResourceGroups.HostedSharePoint))
{
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
index 44a4be21..dc5185a0 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
@@ -3310,8 +3310,8 @@
Domains per Organization
-
- Allow Security Group Management
+
+ Security Groups per Organization
Hosted SharePoint
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationSecurityGroups.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationSecurityGroups.ascx.resx
index 783d8cc6..f39a3eb3 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationSecurityGroups.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationSecurityGroups.ascx.resx
@@ -153,4 +153,7 @@
Notes
+
+ Total Groups Created:
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageCreateFolder.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageCreateFolder.ascx.cs
index 94e2f6a1..3a834210 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageCreateFolder.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageCreateFolder.ascx.cs
@@ -53,15 +53,24 @@ namespace WebsitePanel.Portal.ExchangeServer
}
OrganizationStatistics organizationStats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
+ OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
if (organizationStats.AllocatedEnterpriseStorageSpace != -1)
{
- OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
-
rangeFolderSize.MaximumValue = Math.Round((tenantStats.AllocatedEnterpriseStorageSpace - (decimal)tenantStats.UsedEnterpriseStorageSpace) / OneGb
+ Utils.ParseDecimal(txtFolderSize.Text, 0), 2).ToString();
rangeFolderSize.ErrorMessage = string.Format("The quota you’ve entered exceeds the available quota for tenant ({0}Gb)", rangeFolderSize.MaximumValue);
}
+
+ if (organizationStats.AllocatedGroups != -1)
+ {
+ int groupsAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
+
+ if (groupsAvailable <= 0)
+ {
+ chkAddDefaultGroup.Enabled = false;
+ }
+ }
}
}
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 265648c0..f30c5d02 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs
@@ -164,13 +164,13 @@ namespace WebsitePanel.Portal.ExchangeServer
lnkUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "users",
"SpaceID=" + PanelSecurity.PackageId);
- if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx))
+ if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPS, cntx))
{
securGroupsStat.Visible = true;
groupStats.QuotaUsedValue = orgStats.CreatedGroups;
groupStats.QuotaValue = orgStats.AllocatedGroups;
- if (orgStats.AllocatedUsers != -1) groupStats.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
+ if (orgStats.AllocatedGroups != -1) groupStats.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
lnkGroups.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "secur_groups",
"SpaceID=" + PanelSecurity.PackageId);
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx
index 4c66ecd5..d94cab7c 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx
@@ -1,6 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationSecurityGroups.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.OrganizationSecurityGroups" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
+<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
@@ -78,6 +79,10 @@
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.cs
index 241ada34..0db73130 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.cs
@@ -48,7 +48,29 @@ namespace WebsitePanel.Portal.ExchangeServer
protected void Page_Load(object sender, EventArgs e)
{
+ if (!IsPostBack)
+ {
+ BindStats();
+ }
+ }
+ private void BindStats()
+ {
+ // quota values
+ OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
+ OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
+ groupsQuota.QuotaUsedValue = stats.CreatedGroups;
+ groupsQuota.QuotaValue = stats.AllocatedGroups;
+
+ if (stats.AllocatedGroups != -1)
+ {
+ int groupsAvailable = groupsQuota.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
+
+ if (groupsAvailable <= 0)
+ {
+ btnCreateGroup.Enabled = false;
+ }
+ }
}
protected void btnCreateGroup_Click(object sender, EventArgs e)
@@ -96,6 +118,9 @@ namespace WebsitePanel.Portal.ExchangeServer
// rebind grid
gvGroups.DataBind();
+
+ // bind stats
+ BindStats();
}
catch (Exception ex)
{
@@ -117,7 +142,10 @@ namespace WebsitePanel.Portal.ExchangeServer
gvGroups.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
// rebind grid
- gvGroups.DataBind();
+ gvGroups.DataBind();
+
+ // bind stats
+ BindStats();
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.designer.cs
index b8297224..b5a32259 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.designer.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx.designer.cs
@@ -128,5 +128,23 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.ObjectDataSource odsSecurityGroupsPaged;
+
+ ///
+ /// locQuota control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Localize locQuota;
+
+ ///
+ /// groupsQuota control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::WebsitePanel.Portal.QuotaViewer groupsQuota;
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/OrganizationMenu.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/OrganizationMenu.ascx.cs
index ae3dc544..a624f2e2 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/OrganizationMenu.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/OrganizationMenu.ascx.cs
@@ -142,7 +142,7 @@ namespace WebsitePanel.Portal
if (Utils.CheckQouta(Quotas.ORGANIZATION_USERS, cntx))
items.Add(CreateMenuItem("Users", "users"));
- if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx))
+ if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPS, cntx))
items.Add(CreateMenuItem("SecurityGroups", "secur_groups"));
}