This commit is contained in:
ruslanht 2012-09-25 17:04:06 +03:00
commit a7e191a748
7 changed files with 352 additions and 41 deletions

View file

@ -5485,6 +5485,244 @@ GO
ALTER PROCEDURE [dbo].[GetOCSUsers]
(
@ItemID int,
@SortColumn nvarchar(40),
@SortDirection nvarchar(20),
@Name nvarchar(400),
@Email nvarchar(400),
@StartRow int,
@Count int
)
AS
IF (@Name IS NULL)
BEGIN
SET @Name = '%'
END
IF (@Email IS NULL)
BEGIN
SET @Email = '%'
END
CREATE TABLE #TempOCSUsers
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[AccountID] [int],
[ItemID] [int] NOT NULL,
[AccountName] [nvarchar](300) NOT NULL,
[DisplayName] [nvarchar](300) NOT NULL,
[InstanceID] [nvarchar](50) NOT NULL,
[PrimaryEmailAddress] [nvarchar](300) NULL,
[SamAccountName] [nvarchar](100) NULL
)
IF (@SortColumn = 'DisplayName')
BEGIN
INSERT INTO
#TempOCSUsers
SELECT
ea.AccountID,
ea.ItemID,
ea.AccountName,
ea.DisplayName,
ou.InstanceID,
ea.PrimaryEmailAddress,
ea.SamAccountName
FROM
ExchangeAccounts ea
INNER JOIN
OCSUsers ou
ON
ea.AccountID = ou.AccountID
WHERE
ea.ItemID = @ItemID AND ea.DisplayName LIKE @Name AND ea.PrimaryEmailAddress LIKE @Email
ORDER BY
ea.DisplayName
END
ELSE
BEGIN
INSERT INTO
#TempOCSUsers
SELECT
ea.AccountID,
ea.ItemID,
ea.AccountName,
ea.DisplayName,
ou.InstanceID,
ea.PrimaryEmailAddress,
ea.SamAccountName
FROM
ExchangeAccounts ea
INNER JOIN
OCSUsers ou
ON
ea.AccountID = ou.AccountID
WHERE
ea.ItemID = @ItemID AND ea.DisplayName LIKE @Name AND ea.PrimaryEmailAddress LIKE @Email
ORDER BY
ea.PrimaryEmailAddress
END
DECLARE @RetCount int
SELECT @RetCount = COUNT(ID) FROM #TempOCSUsers
IF (@SortDirection = 'ASC')
BEGIN
SELECT * FROM #TempOCSUsers
WHERE ID > @StartRow AND ID <= (@StartRow + @Count)
END
ELSE
BEGIN
IF (@SortColumn = 'DisplayName')
BEGIN
SELECT * FROM #TempOCSUsers
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY DisplayName DESC
END
ELSE
BEGIN
SELECT * FROM #TempOCSUsers
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY PrimaryEmailAddress DESC
END
END
DROP TABLE #TempOCSUsers
GO
ALTER PROCEDURE [dbo].[GetCRMUsers]
(
@ItemID int,
@SortColumn nvarchar(40),
@SortDirection nvarchar(20),
@Name nvarchar(400),
@Email nvarchar(400),
@StartRow int,
@Count int
)
AS
IF (@Name IS NULL)
BEGIN
SET @Name = '%'
END
IF (@Email IS NULL)
BEGIN
SET @Email = '%'
END
CREATE TABLE #TempCRMUsers
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[AccountID] [int],
[ItemID] [int] NOT NULL,
[AccountName] [nvarchar](300) NOT NULL,
[DisplayName] [nvarchar](300) NOT NULL,
[PrimaryEmailAddress] [nvarchar](300) NULL,
[SamAccountName] [nvarchar](100) NULL
)
IF (@SortColumn = 'DisplayName')
BEGIN
INSERT INTO
#TempCRMUsers
SELECT
ea.AccountID,
ea.ItemID,
ea.AccountName,
ea.DisplayName,
ea.PrimaryEmailAddress,
ea.SamAccountName
FROM
ExchangeAccounts ea
INNER JOIN
CRMUsers cu
ON
ea.AccountID = cu.AccountID
WHERE
ea.ItemID = @ItemID AND ea.DisplayName LIKE @Name AND ea.PrimaryEmailAddress LIKE @Email
ORDER BY
ea.DisplayName
END
ELSE
BEGIN
INSERT INTO
#TempCRMUsers
SELECT
ea.AccountID,
ea.ItemID,
ea.AccountName,
ea.DisplayName,
ea.PrimaryEmailAddress,
ea.SamAccountName
FROM
ExchangeAccounts ea
INNER JOIN
CRMUsers cu
ON
ea.AccountID = cu.AccountID
WHERE
ea.ItemID = @ItemID AND ea.DisplayName LIKE @Name AND ea.PrimaryEmailAddress LIKE @Email
ORDER BY
ea.PrimaryEmailAddress
END
DECLARE @RetCount int
SELECT @RetCount = COUNT(ID) FROM #TempCRMUsers
IF (@SortDirection = 'ASC')
BEGIN
SELECT * FROM #TempCRMUsers
WHERE ID > @StartRow AND ID <= (@StartRow + @Count)
END
ELSE
BEGIN
IF (@SortColumn = 'DisplayName')
BEGIN
SELECT * FROM #TempCRMUsers
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY DisplayName DESC
END
ELSE
BEGIN
SELECT * FROM #TempCRMUsers
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY PrimaryEmailAddress DESC
END
END
DROP TABLE #TempCRMUsers
GO

View file

@ -69,7 +69,7 @@ namespace WebsitePanel.EnterpriseServer {
return ""; return "";
var s = new System.Text.StringBuilder(); var s = new System.Text.StringBuilder();
if (!V6) { if (!V6) {
var ipl = (long)Address; var ipl = Address;
s.Append(String.Format("{0}.{1}.{2}.{3}", (ipl >> 24) & 0xFFL, (ipl >> 16) & 0xFFL, (ipl >> 8) & 0xFFL, (ipl & 0xFFL))); s.Append(String.Format("{0}.{1}.{2}.{3}", (ipl >> 24) & 0xFFL, (ipl >> 16) & 0xFFL, (ipl >> 8) & 0xFFL, (ipl & 0xFFL)));
} else if (!IsMask) { } else if (!IsMask) {

View file

@ -988,7 +988,7 @@ namespace WebsitePanel.EnterpriseServer
if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6."); if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6.");
int i = 0; int i = 0;
long step = (endExternalIP < startExternalIP) ? -1 : 1; long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1;
while (true) while (true)
{ {

View file

@ -143,14 +143,13 @@ namespace WebsitePanel.EnterpriseServer
site.FrontPageAccount = siteItem.FrontPageAccount; site.FrontPageAccount = siteItem.FrontPageAccount;
if (String.IsNullOrEmpty(site.FrontPageAccount)) if (String.IsNullOrEmpty(site.FrontPageAccount))
site.FrontPageAccount = GetFrontPageUsername(site.Name); site.FrontPageAccount = GetFrontPageUsername(site.Name);
#region Restore Web Deploy publishing persistent properties
// Set Web Deploy publishing account // Set Web Deploy publishing account
site.WebDeployPublishingAccount = siteItem.WebDeployPublishingAccount; site.WebDeployPublishingAccount = siteItem.WebDeployPublishingAccount;
// Set Web Deploy site publishing enabled // Set Web Deploy site publishing enabled
site.WebDeploySitePublishingEnabled = siteItem.WebDeploySitePublishingEnabled; site.WebDeploySitePublishingEnabled = siteItem.WebDeploySitePublishingEnabled;
// Set Web Deploy site publishing profile // Set Web Deploy site publishing profile
site.WebDeploySitePublishingProfile = siteItem.WebDeploySitePublishingProfile; site.WebDeploySitePublishingProfile = siteItem.WebDeploySitePublishingProfile;
#endregion
return site; return site;
} }
@ -224,7 +223,7 @@ namespace WebsitePanel.EnterpriseServer
StringDictionary webSettings = ServerController.GetServiceSettings(serviceId); StringDictionary webSettings = ServerController.GetServiceSettings(serviceId);
int addressId = Utils.ParseInt(webSettings["SharedIP"], 0); int addressId = Utils.ParseInt(webSettings["SharedIP"], 0);
bool dedicatedIp = false;
if (packageAddressId != 0) if (packageAddressId != 0)
{ {
// dedicated IP // dedicated IP
@ -232,7 +231,6 @@ namespace WebsitePanel.EnterpriseServer
if (packageIp != null) if (packageIp != null)
{ {
addressId = packageIp.AddressID; addressId = packageIp.AddressID;
dedicatedIp = true;
} }
} }
@ -597,12 +595,7 @@ namespace WebsitePanel.EnterpriseServer
if (siteItem == null) if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND; return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// load assigned IP address
//IPAddressInfo ip = ServerController.GetIPAddress(ipAddressId);
//if (ip == null)
//return BusinessErrorCodes.ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED;
//string ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
int addressId = 0; int addressId = 0;
PackageIPAddress packageIp = ServerController.GetPackageIPAddress(ipAddressId); PackageIPAddress packageIp = ServerController.GetPackageIPAddress(ipAddressId);
if (packageIp != null) if (packageIp != null)
@ -614,7 +607,7 @@ namespace WebsitePanel.EnterpriseServer
// place log record // place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name); TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId; TaskManager.ItemId = siteItemId;
/*
try try
{ {
// remove all web site pointers // remove all web site pointers
@ -635,10 +628,21 @@ namespace WebsitePanel.EnterpriseServer
if (addressId != 0) if (addressId != 0)
ServerController.AddItemIPAddress(siteItemId, addressId); ServerController.AddItemIPAddress(siteItemId, addressId);
AddWebSitePointer(siteItemId, "", domain.DomainId, true, true, true);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.ZoneName);
AddWebSitePointer(siteItemId,
(domain.DomainName.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "": domain.DomainName.Replace("." + domain.ZoneName,"")
, ZoneInfo.DomainId, true, true, true);
foreach (DomainInfo pointer in pointers) foreach (DomainInfo pointer in pointers)
AddWebSitePointer(siteItemId, "", pointer.DomainId, true, true, true); {
ZoneInfo = ServerController.GetDomain(domain.ZoneName);
AddWebSitePointer(siteItemId,
(pointer.DomainName.Replace("." + pointer.ZoneName, "") == pointer.ZoneName) ? "" : pointer.DomainName.Replace("." + pointer.ZoneName, "")
, ZoneInfo.DomainId, true, true, true);
}
return 0; return 0;
} }
@ -650,7 +654,6 @@ namespace WebsitePanel.EnterpriseServer
{ {
TaskManager.CompleteTask(); TaskManager.CompleteTask();
} }
*/
return 0; return 0;
} }
@ -669,18 +672,40 @@ namespace WebsitePanel.EnterpriseServer
// place log record // place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_SHARED_IP", siteItem.Name); TaskManager.StartTask("WEB_SITE", "SWITCH_TO_SHARED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId; TaskManager.ItemId = siteItemId;
/*
try try
{ {
// get web site pointers // remove all web site pointers
var sitePointers = GetWebSitePointers(siteItemId); List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, true, true, false);
// get existing web site bindings // remove web site main pointer
WebServer web = new WebServer(); DomainInfo domain = ServerController.GetDomain(siteItem.Name);
ServiceProviderProxy.Init(web, siteItem.ServiceId); if (domain != null)
var bindings = web.GetSiteBindings(siteItem.SiteId); DeleteWebSitePointer(siteItemId, domain.DomainId, true, true, false);
// TODO - what would be correct logic here? //Deallocate IP Address
ServerController.DeleteItemIPAddress(siteItemId, siteItem.SiteIPAddressId);
// update site item
siteItem.SiteIPAddressId = 0;
PackageController.UpdatePackageItem(siteItem);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.ZoneName);
AddWebSitePointer(siteItemId,
(domain.DomainName.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "" : domain.DomainName.Replace("." + domain.ZoneName, "")
, ZoneInfo.DomainId, true, true, true);
foreach (DomainInfo pointer in pointers)
{
ZoneInfo = ServerController.GetDomain(domain.ZoneName);
AddWebSitePointer(siteItemId,
(pointer.DomainName.Replace("." + pointer.ZoneName, "") == pointer.ZoneName) ? "" : pointer.DomainName.Replace("." + pointer.ZoneName, "")
, ZoneInfo.DomainId, true, true, true);
}
return 0; return 0;
} }
@ -692,7 +717,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
TaskManager.CompleteTask(); TaskManager.CompleteTask();
} }
*/
return 0; return 0;
} }
@ -904,23 +929,18 @@ namespace WebsitePanel.EnterpriseServer
//ignore all other except the host_name record //ignore all other except the host_name record
foreach (GlobalDnsRecord r in dnsRecords) foreach (GlobalDnsRecord r in dnsRecords)
{ {
if (rebuild) if (r.RecordName == "[host_name]")
{ {
if ((r.RecordName + (string.IsNullOrEmpty(r.RecordName) ? domain.ZoneName : "." + domain.ZoneName)) == domain.DomainName) tmpDnsRecords.Add(r); tmpDnsRecords.Add(r);
break;
} }
else
{
if (r.RecordName == "[host_name]") tmpDnsRecords.Add(r);
}
} }
} }
else else
tmpDnsRecords = dnsRecords; tmpDnsRecords = dnsRecords;
List<DnsRecord> resourceRecords = rebuild ? DnsServerController.BuildDnsResourceRecords(tmpDnsRecords, "", domain.DomainName, serviceIp): List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(tmpDnsRecords, hostName, domain.DomainName, serviceIp);
DnsServerController.BuildDnsResourceRecords(tmpDnsRecords, hostName, domain.DomainName, serviceIp);
if (!rebuild) if (!rebuild)
{ {
@ -968,9 +988,6 @@ namespace WebsitePanel.EnterpriseServer
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP; ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
// fill bindings // fill bindings
if (rebuild)
FillWebServerBindings(bindings, dnsRecords, "", domain.DomainName, "", ignoreGlobalDNSRecords);
else
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords); FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
//for logging purposes //for logging purposes

View file

@ -5,11 +5,11 @@
</configSections> </configSections>
<!-- Connection strings --> <!-- Connection strings -->
<connectionStrings> <connectionStrings>
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" providerName="System.Data.SqlClient" /> <add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<!-- Encryption util settings --> <!-- Encryption util settings -->
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" /> <add key="WebsitePanel.CryptoKey" value="1234567890" />
<!-- A1D4KDHUE83NKHddF --> <!-- A1D4KDHUE83NKHddF -->
<add key="WebsitePanel.EncryptionEnabled" value="true" /> <add key="WebsitePanel.EncryptionEnabled" value="true" />
<!-- Web Applications --> <!-- Web Applications -->

View file

@ -1,4 +1,32 @@
//------------------------------------------------------------------------------ // Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// //

View file

@ -1,3 +1,31 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.