wsp-10322 little loophole in MSSQL
This commit is contained in:
parent
ab01ef0469
commit
ce4e1afbd3
4 changed files with 56 additions and 3 deletions
|
@ -1197,6 +1197,24 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@itemName", itemName));
|
||||
}
|
||||
|
||||
public static int GetServiceItemsCountByNameAndServiceId(int actorId, int serviceId, string groupName,
|
||||
string itemName, string itemTypeName)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
object obj = SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetServiceItemsCountByNameAndServiceId",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@ServiceId", serviceId),
|
||||
new SqlParameter("@ItemName", itemName),
|
||||
new SqlParameter("@GroupName", groupName),
|
||||
new SqlParameter("@ItemTypeName", itemTypeName));
|
||||
|
||||
if (!int.TryParse(obj.ToString(), out res)) return -1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static int AddServiceItem(int actorId, int serviceId, int packageId, string itemName,
|
||||
string itemTypeName, string xmlProperties)
|
||||
{
|
||||
|
|
|
@ -125,8 +125,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (serviceId == 0)
|
||||
return BusinessErrorCodes.ERROR_MSSQL_RESOURCE_UNAVAILABLE;
|
||||
|
||||
// check package items
|
||||
if (PackageController.GetPackageItemByName(item.PackageId, groupName, item.Name, typeof(SqlDatabase)) != null)
|
||||
// check service items
|
||||
if (PackageController.GetServiceItemsCountByNameAndServiceId(serviceId, groupName, item.Name, typeof(SqlDatabase)) > 0)
|
||||
return BusinessErrorCodes.ERROR_MSSQL_DATABASES_PACKAGE_ITEM_EXISTS;
|
||||
|
||||
// place log record
|
||||
|
|
|
@ -1380,6 +1380,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return CreateServiceItem(dvItem[0], dsItem.Tables[1].DefaultView);
|
||||
}
|
||||
|
||||
public static int GetServiceItemsCountByNameAndServiceId(int serviceId, string groupName, string itemName, Type itemType)
|
||||
{
|
||||
string itemTypeName = ObjectUtils.GetTypeFullName(itemType);
|
||||
|
||||
return DataProvider.GetServiceItemsCountByNameAndServiceId(SecurityContext.User.UserId,
|
||||
serviceId, groupName, itemName, itemTypeName);
|
||||
}
|
||||
|
||||
public static bool CheckServiceItemExists(string itemName, Type itemType)
|
||||
{
|
||||
return CheckServiceItemExists(itemName, null, itemType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue