Update: Lync: Support for multiple sipdomains per tenant.
Fixed: Hosted Organizations: user principal name updated when settings primary email address. User principal name will not change when changing the primary email address. SIP address is based on EmailAddress
This commit is contained in:
parent
a65b72f858
commit
867e6a96f2
4 changed files with 86 additions and 11 deletions
|
@ -5,11 +5,19 @@
|
|||
</configSections>
|
||||
<!-- Connection strings -->
|
||||
<connectionStrings>
|
||||
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
|
||||
<!--
|
||||
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" />
|
||||
<add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" />
|
||||
-->
|
||||
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" />
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<!-- Encryption util settings -->
|
||||
<add key="WebsitePanel.CryptoKey" value="1234567890" />
|
||||
<!-- A1D4KDHUE83NKHddF -->
|
||||
<!--
|
||||
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
|
||||
<add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" />
|
||||
-->
|
||||
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
|
||||
<!-- A1D4KDHUE83NKHddF -->
|
||||
<add key="WebsitePanel.EncryptionEnabled" value="true" />
|
||||
<!-- Web Applications -->
|
||||
|
|
|
@ -159,6 +159,14 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
collection.Value = value;
|
||||
}
|
||||
|
||||
public static void SetADObjectPropertyValue(DirectoryEntry oDE, string name, string[] values)
|
||||
{
|
||||
PropertyValueCollection collection = oDE.Properties[name];
|
||||
collection.Value = values;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void SetADObjectPropertyValue(DirectoryEntry oDE, string name, Guid value)
|
||||
{
|
||||
PropertyValueCollection collection = oDE.Properties[name];
|
||||
|
@ -177,6 +185,19 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
return entry.Properties.Contains(name) ? entry.Properties[name][0] : null;
|
||||
}
|
||||
|
||||
public static string[] GetADObjectPropertyMultiValue(DirectoryEntry entry, string name)
|
||||
{
|
||||
if (!entry.Properties.Contains(name))
|
||||
return null;
|
||||
|
||||
List<string> returnList = new List<string>();
|
||||
for (int i = 0; i < entry.Properties[name].Count; i++)
|
||||
returnList.Add(entry.Properties[name][i].ToString());
|
||||
|
||||
return returnList.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public static string GetADObjectStringProperty(DirectoryEntry entry, string name)
|
||||
{
|
||||
object ret = GetADObjectProperty(entry, name);
|
||||
|
|
|
@ -2591,7 +2591,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
Command cmd = new Command("Set-Mailbox");
|
||||
cmd.Parameters.Add("Identity", accountName);
|
||||
cmd.Parameters.Add("PrimarySmtpAddress", primaryEmail);
|
||||
cmd.Parameters.Add("UserPrincipalName", primaryEmail);
|
||||
//cmd.Parameters.Add("UserPrincipalName", primaryEmail);
|
||||
cmd.Parameters.Add("WindowsEmailAddress", primaryEmail);
|
||||
|
||||
ExecuteShellCommand(runSpace, cmd);
|
||||
|
|
|
@ -288,11 +288,14 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
Guid tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
|
||||
|
||||
// create sip domain
|
||||
DeleteSipDomain(runSpace, sipDomain);
|
||||
|
||||
//clear the msRTCSIP-Domains, TenantID, ObjectID
|
||||
string path = AddADPrefix(GetOrganizationPath(organizationId));
|
||||
DirectoryEntry ou = ActiveDirectoryUtils.GetADObject(path);
|
||||
string[] sipDs = (string[])ActiveDirectoryUtils.GetADObjectPropertyMultiValue(ou, "msRTCSIP-Domains");
|
||||
|
||||
foreach (string sipD in sipDs)
|
||||
DeleteSipDomain(runSpace, sipD);
|
||||
|
||||
//clear the msRTCSIP-Domains, TenantID, ObjectID
|
||||
ActiveDirectoryUtils.ClearADObjectPropertyValue(ou, "msRTCSIP-Domains");
|
||||
ActiveDirectoryUtils.ClearADObjectPropertyValue(ou, "msRTCSIP-TenantId");
|
||||
ActiveDirectoryUtils.ClearADObjectPropertyValue(ou, "msRTCSIP-ObjectId");
|
||||
|
@ -383,11 +386,56 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
{
|
||||
tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
|
||||
|
||||
string[] tmp = userUpn.Split('@');
|
||||
if (tmp.Length < 2) return false;
|
||||
|
||||
// Get SipDomains and verify existence
|
||||
bool bSipDomainExists = false;
|
||||
cmd = new Command("Get-CsSipDomain");
|
||||
Collection<PSObject> sipDomains = ExecuteShellCommand(runSpace, cmd, false);
|
||||
|
||||
foreach (PSObject domain in sipDomains)
|
||||
{
|
||||
string d = (string)GetPSObjectProperty(domain, "Name");
|
||||
if (d.ToLower() == tmp[1].ToLower())
|
||||
{
|
||||
bSipDomainExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
string path = string.Empty;
|
||||
|
||||
if (!bSipDomainExists)
|
||||
{
|
||||
// Create Sip Domain
|
||||
cmd = new Command("New-CsSipDomain");
|
||||
cmd.Parameters.Add("Identity", tmp[1].ToLower());
|
||||
ExecuteShellCommand(runSpace, cmd, false);
|
||||
|
||||
transaction.RegisterNewSipDomain(tmp[1].ToLower());
|
||||
|
||||
|
||||
path = AddADPrefix(GetOrganizationPath(organizationId));
|
||||
DirectoryEntry ou = ActiveDirectoryUtils.GetADObject(path);
|
||||
string[] sipDs = (string[])ActiveDirectoryUtils.GetADObjectPropertyMultiValue(ou, "msRTCSIP-Domains");
|
||||
List<string> listSipDs = new List<string>();
|
||||
listSipDs.AddRange(sipDs);
|
||||
listSipDs.Add(tmp[1]);
|
||||
|
||||
ActiveDirectoryUtils.SetADObjectPropertyValue(ou, "msRTCSIP-Domains", listSipDs.ToArray());
|
||||
ou.CommitChanges();
|
||||
|
||||
//Create simpleurls
|
||||
CreateSimpleUrl(runSpace, tmp[1].ToLower(), tenantId);
|
||||
transaction.RegisterNewSimpleUrl(tmp[1].ToLower(), tenantId.ToString());
|
||||
}
|
||||
|
||||
//enable for lync
|
||||
cmd = new Command("Enable-CsUser");
|
||||
cmd.Parameters.Add("Identity", userUpn);
|
||||
cmd.Parameters.Add("RegistrarPool", PoolFQDN);
|
||||
cmd.Parameters.Add("SipAddressType", "UserPrincipalName");
|
||||
cmd.Parameters.Add("SipAddressType", "EmailAddress");
|
||||
ExecuteShellCommand(runSpace, cmd);
|
||||
|
||||
transaction.RegisterNewCsUser(userUpn);
|
||||
|
@ -397,13 +445,11 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
cmd.Parameters.Add("Identity", userUpn);
|
||||
result = ExecuteShellCommand(runSpace, cmd);
|
||||
|
||||
|
||||
string path = AddADPrefix(GetResultObjectDN(result));
|
||||
path = AddADPrefix(GetResultObjectDN(result));
|
||||
DirectoryEntry user = ActiveDirectoryUtils.GetADObject(path);
|
||||
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-GroupingID", tenantId);
|
||||
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-TenantId", tenantId);
|
||||
|
||||
string[] tmp = userUpn.Split('@');
|
||||
if (tmp.Length > 0)
|
||||
{
|
||||
string Url = SimpleUrlRoot + tmp[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue