Extended hosting plans (quotas) option to block tenant from creating and

deleting top domains.
This commit is contained in:
robvde 2012-09-10 21:26:38 +04:00
parent 2f569ccd05
commit 0b31970c71
8 changed files with 43 additions and 4 deletions

View file

@ -4063,6 +4063,9 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDe
GO
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (400, 20, 3, N'HostedSharePoint.UseSharedSSL', N'Use shared SSL Root', 1, 0, NULL)
GO
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (410, 1, 12, N'OS.AllowTenantCreateDomains', N'Allow Tenants to Create Top Level Domains', 1, 0, NULL)
GO
SET ANSI_NULLS ON
GO

View file

@ -467,6 +467,11 @@ END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'OS.AllowTenantCreateDomains')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (410, 1, 12, N'OS.AllowTenantCreateDomains', N'Allow Tenants to Create Top Level Domains', 1, 0, NULL)
END
GO
DELETE FROM [dbo].[PackageQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.POP3Enabled')

View file

@ -50,6 +50,7 @@ order by rg.groupOrder
public const string OS_MINIMUMTASKINTERVAL = "OS.MinimumTaskInterval"; // Minimum Tasks Interval, minutes
public const string OS_APPINSTALLER = "OS.AppInstaller"; // Applications Installer
public const string OS_EXTRAAPPLICATIONS = "OS.ExtraApplications"; // Extra Application Packs
public const string OS_ALLOWTENANTCREATEDOMAINS = "OS.AllowTenantCreateDomains"; // Allow tenant to create top level domains
public const string WEB_SITES = "Web.Sites"; // Web Sites
public const string WEB_ASPNET11 = "Web.AspNet11"; // ASP.NET 1.1
public const string WEB_ASPNET20 = "Web.AspNet20"; // ASP.NET 2.0

View file

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C57D3F9F-7BA0-4D38-A159-B6EDA5C19B13}"
ProjectSection(SolutionItems) = preProject
..\Database\install_db.sql = ..\Database\install_db.sql
@ -7,7 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\Readme.htm = ..\..\Readme.htm
..\..\ReleaseNotes.htm = ..\..\ReleaseNotes.htm
..\Database\update_db.sql = ..\Database\update_db.sql
VersionInfo.cs = VersionInfo.cs
VersionInfo.vb = VersionInfo.vb
EndProjectSection
EndProject

View file

@ -1,11 +1,10 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BB38798E-1528-493C-868E-005102316536}"
ProjectSection(SolutionItems) = preProject
..\..\LICENSE.txt = ..\..\LICENSE.txt
..\..\Readme.htm = ..\..\Readme.htm
..\..\ReleaseNotes.htm = ..\..\ReleaseNotes.htm
VersionInfo.cs = VersionInfo.cs
VersionInfo.vb = VersionInfo.vb
EndProjectSection
EndProject

View file

@ -1590,6 +1590,9 @@
<data name="Quota.OS.FileManager" xml:space="preserve">
<value>File Manager</value>
</data>
<data name="Quota.OS.AllowTenantCreateDomains" xml:space="preserve">
<value>Tenant Top-Level Domain creation Allowed</value>
</data>
<data name="Quota.SharePoint.Groups" xml:space="preserve">
<value>SharePoint Groups</value>
</data>

View file

@ -55,6 +55,21 @@ namespace WebsitePanel.Portal
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_ALLOWTENANTCREATEDOMAINS, cntx);
}
}
}
DomainInfo[] myDomains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId);
bool enableSubDomains = false;
foreach(DomainInfo domain in myDomains)

View file

@ -142,6 +142,20 @@ namespace WebsitePanel.Portal
{
ResellersPanel.Visible = true;
}
if (!(domain.IsDomainPointer || domain.IsSubDomain || domain.IsInstantAlias))
{
UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);
if (user != null)
{
if (user.Role == UserRole.User)
{
btnDelete.Enabled = Utils.CheckQouta(Quotas.OS_ALLOWTENANTCREATEDOMAINS, cntx);
}
}
}
}
catch (Exception ex)
{