diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index c28f6f0b..5ce2c55b 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -35236,12 +35236,15 @@ EXEC sp_xml_preparedocument @idoc OUTPUT, @XmlProperties DELETE FROM ServiceItemProperties WHERE ItemID = @ItemID -INSERT INTO ServiceItemProperties -( - ItemID, - PropertyName, - PropertyValue -) +-- Add the xml data into a temp table for the capability and robust +IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL DROP TABLE #TempTable + +CREATE TABLE #TempTable( + ItemID int, + PropertyName nvarchar(50), + PropertyValue nvarchar(3000)) + +INSERT INTO #TempTable (ItemID, PropertyName, PropertyValue) SELECT @ItemID, PropertyName, @@ -35252,6 +35255,21 @@ FROM OPENXML(@idoc, '/properties/property',1) WITH PropertyValue nvarchar(3000) '@value' ) as PV +-- Move data from temp table to real table +INSERT INTO ServiceItemProperties +( + ItemID, + PropertyName, + PropertyValue +) +SELECT + ItemID, + PropertyName, + PropertyValue +FROM #TempTable + +DROP TABLE #TempTable + -- remove document exec sp_xml_removedocument @idoc diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index f72a0a4b..02063d63 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -8306,4 +8306,82 @@ IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTasks] WHERE [TaskID] = 'SCHEDULE_TA BEGIN INSERT INTO [dbo].[ScheduleTasks] ([TaskID], [TaskType], [RoleID]) VALUES (N'SCHEDULE_TASK_DELETE_EXCHANGE_ACCOUNTS', N'WebsitePanel.EnterpriseServer.DeleteExchangeAccountsTask, WebsitePanel.EnterpriseServer.Code', 3) END -GO \ No newline at end of file +GO + + + + + +ALTER PROCEDURE [dbo].[UpdateServiceItem] +( + @ActorID int, + @ItemID int, + @ItemName nvarchar(500), + @XmlProperties ntext +) +AS +BEGIN TRAN + +-- check rights +DECLARE @PackageID int +SELECT PackageID = @PackageID FROM ServiceItems +WHERE ItemID = @ItemID + +IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0 +RAISERROR('You are not allowed to access this package', 16, 1) + +-- update item +UPDATE ServiceItems SET ItemName = @ItemName +WHERE ItemID=@ItemID + +DECLARE @idoc int +--Create an internal representation of the XML document. +EXEC sp_xml_preparedocument @idoc OUTPUT, @XmlProperties + +-- Execute a SELECT statement that uses the OPENXML rowset provider. +DELETE FROM ServiceItemProperties +WHERE ItemID = @ItemID + +-- Add the xml data into a temp table for the capability and robust +IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL DROP TABLE #TempTable + +CREATE TABLE #TempTable( + ItemID int, + PropertyName nvarchar(50), + PropertyValue nvarchar(3000)) + +INSERT INTO #TempTable (ItemID, PropertyName, PropertyValue) +SELECT + @ItemID, + PropertyName, + PropertyValue +FROM OPENXML(@idoc, '/properties/property',1) WITH +( + PropertyName nvarchar(50) '@name', + PropertyValue nvarchar(3000) '@value' +) as PV + +-- Move data from temp table to real table +INSERT INTO ServiceItemProperties +( + ItemID, + PropertyName, + PropertyValue +) +SELECT + ItemID, + PropertyName, + PropertyValue +FROM #TempTable + +DROP TABLE #TempTable + +-- remove document +exec sp_xml_removedocument @idoc + +COMMIT TRAN + +RETURN +GO + + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Delegation/DelegationRulesModuleService.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Delegation/DelegationRulesModuleService.cs index d5d098f8..ee5f1cd3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Delegation/DelegationRulesModuleService.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Delegation/DelegationRulesModuleService.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using WebsitePanel.Providers.Web.Iis.Common; using Microsoft.Web.Administration; @@ -45,8 +46,12 @@ namespace WebsitePanel.Providers.Web.Delegation using (var srvman = new ServerManager()) { var adminConfig = srvman.GetAdministrationConfiguration(); - // - var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); + + // return if system.webServer/management/delegation section is not exist in config file + if (!HasDelegationSection(adminConfig)) + return; + + var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); // var rulesCollection = delegationSection.GetCollection(); // Update rule if exists @@ -103,8 +108,12 @@ namespace WebsitePanel.Providers.Web.Delegation using (var srvman = new ServerManager()) { var adminConfig = srvman.GetAdministrationConfiguration(); - // - var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); + + // return if system.webServer/management/delegation section is not exist in config file + if (!HasDelegationSection(adminConfig)) + return; + + var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); // var rulesCollection = delegationSection.GetCollection(); // Update rule if exists @@ -142,8 +151,12 @@ namespace WebsitePanel.Providers.Web.Delegation using (var srvman = new ServerManager()) { var adminConfig = srvman.GetAdministrationConfiguration(); - // - var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); + + // return if system.webServer/management/delegation section is not exist in config file + if (!HasDelegationSection(adminConfig)) + return false; + + var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); // var rulesCollection = delegationSection.GetCollection(); // Update rule if exists @@ -171,8 +184,12 @@ namespace WebsitePanel.Providers.Web.Delegation using (var srvman = GetServerManager()) { var adminConfig = srvman.GetAdministrationConfiguration(); - // - var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); + + // return if system.webServer/management/delegation section is not exist in config file + if (!HasDelegationSection(adminConfig)) + return; + + var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); // var rulesCollection = delegationSection.GetCollection(); // Update rule if exists @@ -245,8 +262,12 @@ namespace WebsitePanel.Providers.Web.Delegation using (var srvman = GetServerManager()) { var adminConfig = srvman.GetAdministrationConfiguration(); - // - var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); + + // return if system.webServer/management/delegation section is not exist in config file + if (!HasDelegationSection(adminConfig)) + return; + + var delegationSection = adminConfig.GetSection("system.webServer/management/delegation"); // var rulesCollection = delegationSection.GetCollection(); // Remove rule if exists @@ -264,5 +285,21 @@ namespace WebsitePanel.Providers.Web.Delegation } } } + + private bool HasDelegationSection(Configuration adminConfig) + { + // try to get delegation section in config file (C:\Windows\system32\inetsrv\config\administration.config) + try + { + adminConfig.GetSection("system.webServer/management/delegation"); + } + catch (Exception ex) + { + /* skip */ + return false; + } + + return true; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs index 668306c4..163eb5c9 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs @@ -2072,7 +2072,7 @@ namespace WebsitePanel.Providers.Web public new void GrantWebDeployPublishingAccess(string siteName, string accountName, string accountPassword) { // Web Publishing Access feature requires FullControl permissions on the web site's wwwroot folder - //GrantWebManagementAccessInternally(siteName, accountName, accountPassword, NTFSPermission.FullControl); + GrantWebManagementAccessInternally(siteName, accountName, accountPassword, NTFSPermission.FullControl); // EnforceDelegationRulesRestrictions(siteName, accountName); } @@ -2086,7 +2086,7 @@ namespace WebsitePanel.Providers.Web public new void RevokeWebDeployPublishingAccess(string siteName, string accountName) { // Web Publishing Access feature requires FullControl permissions on the web site's wwwroot folder - //RevokeWebManagementAccess(siteName, accountName); + RevokeWebManagementAccess(siteName, accountName); // RemoveDelegationRulesRestrictions(siteName, accountName); } @@ -4336,13 +4336,13 @@ namespace WebsitePanel.Providers.Web protected string GetFullQualifiedAccountName(string accountName) { + if (accountName.IndexOf("\\") != -1) + return accountName; // already has domain information + // if (!ServerSettings.ADEnabled) return String.Format(@"{0}\{1}", Environment.MachineName, accountName); - if (accountName.IndexOf("\\") != -1) - return accountName; // already has domain information - // DO IT FOR ACTIVE DIRECTORY MODE ONLY string domainName = null; try diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesEditSite.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesEditSite.ascx.cs index 125c354c..be04563f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesEditSite.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesEditSite.ascx.cs @@ -546,7 +546,7 @@ namespace WebsitePanel.Portal WDeployPublishingConfirmPasswordTextBox, WDeployPublishingAccountRequiredFieldValidator); - WDeployPublishingAccountTextBox.Text = AutoSuggestWmSvcAccontName(item, "_dploy"); + WDeployPublishingAccountTextBox.Text = AutoSuggestWmSvcAccontName(item, "_deploy"); // WDeployPublishingAccountRequiredFieldValidator.Enabled = true; //