Fixed in Web Engines: check allowed engines (hosting plan quotas) is enabled
This commit is contained in:
parent
4825e8aac8
commit
e2283b5358
3 changed files with 51 additions and 6 deletions
|
@ -4050,6 +4050,26 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetServiceIdForProviderIdAndPackageId(int providerId, int packageId)
|
||||||
|
{
|
||||||
|
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
|
||||||
|
@"SELECT PackageServices.ServiceID
|
||||||
|
FROM PackageServices
|
||||||
|
INNER JOIN Services ON PackageServices.ServiceID = Services.ServiceID
|
||||||
|
WHERE Services.ProviderID = @ProviderID and PackageID = @PackageID",
|
||||||
|
new SqlParameter("@ProviderID", providerId),
|
||||||
|
new SqlParameter("@PackageID", packageId)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
return (int)reader["ServiceID"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static int GetServerIdForPackage(int packageId)
|
public static int GetServerIdForPackage(int packageId)
|
||||||
{
|
{
|
||||||
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
|
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
|
||||||
|
|
|
@ -76,6 +76,31 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public static ShortHeliconZooEngine[] GetAllowedHeliconZooQuotasForPackage(int packageId)
|
public static ShortHeliconZooEngine[] GetAllowedHeliconZooQuotasForPackage(int packageId)
|
||||||
{
|
{
|
||||||
|
// first, check IsEnginesAllowed for this server
|
||||||
|
|
||||||
|
// get helicon zoo provider serviceId
|
||||||
|
int heliconZooProviderId, heliconZooGroupId;
|
||||||
|
DataProvider.GetHeliconZooProviderAndGroup("HeliconZoo", out heliconZooProviderId, out heliconZooGroupId);
|
||||||
|
|
||||||
|
// get helicon zoo service id for heliconZooProviderId and packageId
|
||||||
|
int serviceId = DataProvider.GetServiceIdForProviderIdAndPackageId(heliconZooProviderId, packageId);
|
||||||
|
|
||||||
|
if (serviceId > 0)
|
||||||
|
{
|
||||||
|
if (IsEnginesEnabled(serviceId))
|
||||||
|
{
|
||||||
|
// all engines allowed by default
|
||||||
|
return new ShortHeliconZooEngine[]
|
||||||
|
{
|
||||||
|
new ShortHeliconZooEngine{Name = "*", DisplayName = "*", Enabled = true}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// all engines is not allowed
|
||||||
|
// get allowed engines from hosting plan quotas
|
||||||
|
|
||||||
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>();
|
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>();
|
||||||
|
|
||||||
IDataReader reader = DataProvider.GetEnabledHeliconZooQuotasForPackage(packageId);
|
IDataReader reader = DataProvider.GetEnabledHeliconZooQuotasForPackage(packageId);
|
||||||
|
|
|
@ -58,8 +58,6 @@ namespace WebsitePanel.Portal
|
||||||
Array.Sort(allowedEngineArray, new ShortHeliconZooEngineComparer());
|
Array.Sort(allowedEngineArray, new ShortHeliconZooEngineComparer());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get enabled engines for this site from applicationHost.config
|
// get enabled engines for this site from applicationHost.config
|
||||||
string[] enabledEngineNames = ES.Services.HeliconZoo.GetEnabledEnginesForSite(site.SiteId, site.PackageId);
|
string[] enabledEngineNames = ES.Services.HeliconZoo.GetEnabledEnginesForSite(site.SiteId, site.PackageId);
|
||||||
ViewState["EnabledEnginesNames"] = enabledEngineNames;
|
ViewState["EnabledEnginesNames"] = enabledEngineNames;
|
||||||
|
@ -68,10 +66,9 @@ namespace WebsitePanel.Portal
|
||||||
ViewState["IsZooWebConsoleEnabled"] = enabledEngineNames.Contains("console", StringComparer.OrdinalIgnoreCase);
|
ViewState["IsZooWebConsoleEnabled"] = enabledEngineNames.Contains("console", StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>(allowedEngineArray);
|
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>(allowedEngineArray);
|
||||||
|
|
||||||
|
// fix engine name and check is web console enabled
|
||||||
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
||||||
{
|
{
|
||||||
engine.Name = engine.Name.Replace("HeliconZoo.", "");
|
engine.Name = engine.Name.Replace("HeliconZoo.", "");
|
||||||
|
@ -82,7 +79,6 @@ namespace WebsitePanel.Portal
|
||||||
//console allowed in hosting plan
|
//console allowed in hosting plan
|
||||||
ViewState["IsZooWebConsoleEnabled"] = engine.Enabled;
|
ViewState["IsZooWebConsoleEnabled"] = engine.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewState["AllowedEngines"] = allowedEngines;
|
ViewState["AllowedEngines"] = allowedEngines;
|
||||||
|
@ -146,7 +142,11 @@ namespace WebsitePanel.Portal
|
||||||
continue; //skip
|
continue; //skip
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase))
|
if (
|
||||||
|
string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase)
|
||||||
|
||
|
||||||
|
engine.Name == "*"
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
filteredApplications.Add(application);
|
filteredApplications.Add(application);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue