merge commt
This commit is contained in:
commit
ff8bebe9bd
7 changed files with 116 additions and 33 deletions
|
@ -6220,7 +6220,7 @@ GO
|
||||||
|
|
||||||
|
|
||||||
CREATE PROCEDURE [dbo].[GetItemIdByOrganizationId]
|
CREATE PROCEDURE [dbo].[GetItemIdByOrganizationId]
|
||||||
@OrganizationId nvarchar(10)
|
@OrganizationId nvarchar(128)
|
||||||
AS
|
AS
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NOCOUNT ON;
|
SET NOCOUNT ON;
|
||||||
|
|
|
@ -6439,3 +6439,19 @@ GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[GetItemIdByOrganizationId]
|
||||||
|
@OrganizationId nvarchar(128)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON;
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
ItemID
|
||||||
|
FROM
|
||||||
|
dbo.ExchangeOrganizations
|
||||||
|
WHERE
|
||||||
|
OrganizationId = @OrganizationId
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
Global.TempDomain = serviceSettings["TempDomain"];
|
Global.TempDomain = serviceSettings["TempDomain"];
|
||||||
ServerInfo serverInfo = ServerController.GetServerById(serviceInfo.ServerId);
|
ServerInfo serverInfo = ServerController.GetServerById(serviceInfo.ServerId);
|
||||||
Global.ADRootDomain = serverInfo.ADRootDomain;
|
Global.ADRootDomain = serverInfo.ADRootDomain;
|
||||||
|
Global.NetBiosDomain = ActiveDirectoryUtils.GetNETBIOSDomainName(Global.ADRootDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBrowseOU(object sender, EventArgs e)
|
private void OnBrowseOU(object sender, EventArgs e)
|
||||||
|
|
|
@ -58,6 +58,13 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
set { aDRootDomain = value; }
|
set { aDRootDomain = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string netBiosDomain;
|
||||||
|
public static string NetBiosDomain
|
||||||
|
{
|
||||||
|
get { return netBiosDomain; }
|
||||||
|
set { netBiosDomain = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public static PackageInfo Space;
|
public static PackageInfo Space;
|
||||||
public static string TempDomain;
|
public static string TempDomain;
|
||||||
|
|
||||||
|
|
|
@ -757,15 +757,19 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
if (EmailAddressExists(email))
|
if (EmailAddressExists(email))
|
||||||
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
|
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (AccountExists(accountName))
|
if (AccountExists(accountName))
|
||||||
throw new Exception(string.Format("Account {0} already exists", accountName));
|
throw new Exception(string.Format("Account {0} already exists", accountName));
|
||||||
|
|
||||||
string displayName = (string)entry.Properties["displayName"].Value;
|
string displayName = (string)entry.Properties["displayName"].Value;
|
||||||
|
|
||||||
|
string samName = (string)entry.Properties["sAMAccountName"].Value;
|
||||||
|
// this should really NEVER happen - an AD account without sAMAccountName?!
|
||||||
|
if (string.IsNullOrEmpty(samName))
|
||||||
|
throw new Exception("SAMAccountName is not specified");
|
||||||
|
// add Netbios-Domainname before samAccountName - format in the database
|
||||||
|
samName = Global.NetBiosDomain + "\\" + samName;
|
||||||
|
|
||||||
int userId = AddOrganizationUser(itemId, accountName, displayName, email, string.Empty);
|
int userId = AddOrganizationUser(itemId, accountName, displayName, email, samName, string.Empty);
|
||||||
AddAccountEmailAddress(userId, email);
|
AddAccountEmailAddress(userId, email);
|
||||||
|
|
||||||
//account type
|
//account type
|
||||||
|
@ -796,7 +800,7 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateExchangeAccount(userId, accountName, accountType, displayName, email, false, string.Empty, string.Empty, string.Empty);
|
UpdateExchangeAccount(userId, accountName, accountType, displayName, email, false, string.Empty, samName, string.Empty);
|
||||||
|
|
||||||
string defaultEmail = (string)entry.Properties["extensionAttribute3"].Value;
|
string defaultEmail = (string)entry.Properties["extensionAttribute3"].Value;
|
||||||
|
|
||||||
|
@ -847,7 +851,7 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
if (email != null && email.ToLower().StartsWith("smtp:"))
|
if (email != null && email.ToLower().StartsWith("smtp:"))
|
||||||
email = email.Substring(5);
|
email = email.Substring(5);
|
||||||
|
|
||||||
|
// no sAMAccountName for contacts - so String.Empty is OK
|
||||||
int accountId = AddAccount(itemId, ExchangeAccountType.Contact, accountName, displayName, email, false, 0, string.Empty, null);
|
int accountId = AddAccount(itemId, ExchangeAccountType.Contact, accountName, displayName, email, false, 0, string.Empty, null);
|
||||||
|
|
||||||
Log.WriteEnd("Contact imported");
|
Log.WriteEnd("Contact imported");
|
||||||
|
@ -886,7 +890,14 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
if (EmailAddressExists(email))
|
if (EmailAddressExists(email))
|
||||||
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
|
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
|
||||||
|
|
||||||
int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, accountName, displayName, email, false, 0, string.Empty, null);
|
string samName = (string)entry.Properties["sAMAccountName"].Value;
|
||||||
|
// this should really NEVER happen - an AD group without sAMAccountName?!
|
||||||
|
if (string.IsNullOrEmpty(samName))
|
||||||
|
throw new Exception("SAMAccountName is not specified");
|
||||||
|
// add Netbios-Domainname before samAccountName - format in the database
|
||||||
|
samName = Global.NetBiosDomain + "\\" + samName;
|
||||||
|
|
||||||
|
int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, accountName, displayName, email, false, 0, samName, null);
|
||||||
AddAccountEmailAddress(accountId, email);
|
AddAccountEmailAddress(accountId, email);
|
||||||
|
|
||||||
string defaultEmail = (string)entry.Properties["extensionAttribute3"].Value;
|
string defaultEmail = (string)entry.Properties["extensionAttribute3"].Value;
|
||||||
|
@ -938,10 +949,10 @@ namespace WebsitePanel.Import.Enterprise
|
||||||
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword),0, string.Empty);
|
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword),0, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int AddOrganizationUser(int itemId, string accountName, string displayName, string email, string accountPassword)
|
private static int AddOrganizationUser(int itemId, string accountName, string displayName, string email, string samAccountName, string accountPassword)
|
||||||
{
|
{
|
||||||
return DataProvider.AddExchangeAccount(itemId, (int)ExchangeAccountType.User, accountName, displayName, email, false, string.Empty,
|
return DataProvider.AddExchangeAccount(itemId, (int)ExchangeAccountType.User, accountName, displayName, email, false, string.Empty,
|
||||||
string.Empty, CryptoUtils.Encrypt(accountPassword),0 , string.Empty);
|
samAccountName, CryptoUtils.Encrypt(accountPassword), 0 , string.Empty);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||||
<WebProjectProperties>
|
<WebProjectProperties>
|
||||||
<UseIIS>True</UseIIS>
|
<UseIIS>False</UseIIS>
|
||||||
<AutoAssignPort>False</AutoAssignPort>
|
<AutoAssignPort>False</AutoAssignPort>
|
||||||
<DevelopmentServerPort>9002</DevelopmentServerPort>
|
<DevelopmentServerPort>9002</DevelopmentServerPort>
|
||||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||||
|
|
|
@ -607,15 +607,42 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
ExchangeLog.LogStart("GetDatabase");
|
ExchangeLog.LogStart("GetDatabase");
|
||||||
ExchangeLog.LogInfo("DAG: " + dagName);
|
ExchangeLog.LogInfo("DAG: " + dagName);
|
||||||
|
|
||||||
//Get Dag Servers
|
// this part of code handles mailboxnames like in the old 2007 provider
|
||||||
|
// check if DAG is in reality DAG\mailboxdatabase
|
||||||
|
string dagNameDAG = string.Empty;
|
||||||
|
string dagNameMBX = string.Empty;
|
||||||
|
bool isFixedDatabase = false;
|
||||||
|
if (dagName.Contains("\\"))
|
||||||
|
{
|
||||||
|
// split the two parts and extract DAG-Name and mailboxdatabase-name
|
||||||
|
string[] parts = dagName.Split(new char[] { '\\' }, 2, StringSplitOptions.None);
|
||||||
|
dagNameDAG = parts[0];
|
||||||
|
dagNameMBX = parts[1];
|
||||||
|
// check that we realy have a database name
|
||||||
|
if (!String.IsNullOrEmpty(dagNameMBX))
|
||||||
|
{
|
||||||
|
isFixedDatabase = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// there is no mailboxdatabase-name use the loadbalancing-code
|
||||||
|
dagNameDAG = dagName;
|
||||||
|
isFixedDatabase = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get Dag Servers - with the name of the database availability group
|
||||||
Collection<PSObject> dags = null;
|
Collection<PSObject> dags = null;
|
||||||
Command cmd = new Command("Get-DatabaseAvailabilityGroup");
|
Command cmd = new Command("Get-DatabaseAvailabilityGroup");
|
||||||
cmd.Parameters.Add("Identity", dagName);
|
cmd.Parameters.Add("Identity", dagNameDAG);
|
||||||
dags = ExecuteShellCommand(runSpace, cmd);
|
dags = ExecuteShellCommand(runSpace, cmd);
|
||||||
|
|
||||||
if (htBbalancer == null)
|
if (htBbalancer == null)
|
||||||
htBbalancer = new Hashtable();
|
htBbalancer = new Hashtable();
|
||||||
|
|
||||||
|
// use fully qualified dagName for loadbalancer. Thus if there are two services and one of them
|
||||||
|
// contains only the DAG, the "fixed" database could also be used in loadbalancing. If you do not want this,
|
||||||
|
// set either IsExcludedFromProvisioning or IsSuspendedFromProvisioning - it is not evaluated for fixed databases
|
||||||
if (htBbalancer[dagName] == null)
|
if (htBbalancer[dagName] == null)
|
||||||
htBbalancer.Add(dagName, 0);
|
htBbalancer.Add(dagName, 0);
|
||||||
|
|
||||||
|
@ -628,6 +655,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
{
|
{
|
||||||
System.Collections.Generic.List<string> lstDatabase = new System.Collections.Generic.List<string>();
|
System.Collections.Generic.List<string> lstDatabase = new System.Collections.Generic.List<string>();
|
||||||
|
|
||||||
|
if (!isFixedDatabase) // "old" loadbalancing code
|
||||||
|
{
|
||||||
foreach (object objServer in servers)
|
foreach (object objServer in servers)
|
||||||
{
|
{
|
||||||
Collection<PSObject> databases = null;
|
Collection<PSObject> databases = null;
|
||||||
|
@ -660,6 +689,25 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else // new fixed database code
|
||||||
|
{
|
||||||
|
Collection<PSObject> databases = null;
|
||||||
|
cmd = new Command("Get-MailboxDatabase");
|
||||||
|
cmd.Parameters.Add("Identity", dagNameMBX);
|
||||||
|
databases = ExecuteShellCommand(runSpace, cmd);
|
||||||
|
|
||||||
|
// do not check "IsExcludedFromProvisioning" or "IsSuspended", just check if it is a member of the DAG
|
||||||
|
foreach (PSObject objDatabase in databases)
|
||||||
|
{
|
||||||
|
string dagSetting = ObjToString(GetPSObjectProperty(objDatabase, "MasterServerOrAvailabilityGroup"));
|
||||||
|
if (dagNameDAG.Equals(dagSetting, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
lstDatabase.Add(dagNameMBX);
|
||||||
|
ExchangeLog.LogInfo("AddFixedDatabase: " + dagNameMBX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int balancer = (int)htBbalancer[dagName];
|
int balancer = (int)htBbalancer[dagName];
|
||||||
balancer++;
|
balancer++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue