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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
|
||||
|
|
|
@ -76,6 +76,31 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
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>();
|
||||
|
||||
IDataReader reader = DataProvider.GetEnabledHeliconZooQuotasForPackage(packageId);
|
||||
|
|
|
@ -58,20 +58,17 @@ namespace WebsitePanel.Portal
|
|||
Array.Sort(allowedEngineArray, new ShortHeliconZooEngineComparer());
|
||||
|
||||
|
||||
|
||||
|
||||
// get enabled engines for this site from applicationHost.config
|
||||
string[] enabledEngineNames = ES.Services.HeliconZoo.GetEnabledEnginesForSite(site.SiteId, site.PackageId);
|
||||
ViewState["EnabledEnginesNames"] = enabledEngineNames;
|
||||
|
||||
//console allowed in applicationHost.config
|
||||
ViewState["IsZooWebConsoleEnabled"] = enabledEngineNames.Contains("console", StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
||||
|
||||
|
||||
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>(allowedEngineArray);
|
||||
|
||||
// fix engine name and check is web console enabled
|
||||
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
||||
{
|
||||
engine.Name = engine.Name.Replace("HeliconZoo.", "");
|
||||
|
@ -82,7 +79,6 @@ namespace WebsitePanel.Portal
|
|||
//console allowed in hosting plan
|
||||
ViewState["IsZooWebConsoleEnabled"] = engine.Enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ViewState["AllowedEngines"] = allowedEngines;
|
||||
|
@ -146,7 +142,11 @@ namespace WebsitePanel.Portal
|
|||
continue; //skip
|
||||
}
|
||||
|
||||
if (string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase))
|
||||
if (
|
||||
string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase)
|
||||
||
|
||||
engine.Name == "*"
|
||||
)
|
||||
{
|
||||
|
||||
filteredApplications.Add(application);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue