merge commit

This commit is contained in:
robvde 2013-08-22 09:01:22 +04:00
commit 754d9127de
73 changed files with 6049 additions and 383 deletions

View file

@ -3710,7 +3710,20 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@Conferencing", lyncUserPlan.Conferencing),
new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice),
new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy),
new SqlParameter("@IsDefault", lyncUserPlan.IsDefault)
new SqlParameter("@IsDefault", lyncUserPlan.IsDefault),
new SqlParameter("@RemoteUserAccess", lyncUserPlan.RemoteUserAccess),
new SqlParameter("@PublicIMConnectivity", lyncUserPlan.PublicIMConnectivity),
new SqlParameter("@AllowOrganizeMeetingsWithExternalAnonymous", lyncUserPlan.AllowOrganizeMeetingsWithExternalAnonymous),
new SqlParameter("@Telephony", lyncUserPlan.Telephony),
new SqlParameter("@ServerURI", lyncUserPlan.ServerURI),
new SqlParameter("@ArchivePolicy", lyncUserPlan.ArchivePolicy),
new SqlParameter("@TelephonyDialPlanPolicy", lyncUserPlan.TelephonyDialPlanPolicy),
new SqlParameter("@TelephonyVoicePolicy", lyncUserPlan.TelephonyVoicePolicy)
);
return Convert.ToInt32(outParam.Value);
@ -3733,7 +3746,20 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@Conferencing", lyncUserPlan.Conferencing),
new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice),
new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy),
new SqlParameter("@IsDefault", lyncUserPlan.IsDefault)
new SqlParameter("@IsDefault", lyncUserPlan.IsDefault),
new SqlParameter("@RemoteUserAccess", lyncUserPlan.RemoteUserAccess),
new SqlParameter("@PublicIMConnectivity", lyncUserPlan.PublicIMConnectivity),
new SqlParameter("@AllowOrganizeMeetingsWithExternalAnonymous", lyncUserPlan.AllowOrganizeMeetingsWithExternalAnonymous),
new SqlParameter("@Telephony", lyncUserPlan.Telephony),
new SqlParameter("@ServerURI", lyncUserPlan.ServerURI),
new SqlParameter("@ArchivePolicy", lyncUserPlan.ArchivePolicy),
new SqlParameter("@TelephonyDialPlanPolicy", lyncUserPlan.TelephonyDialPlanPolicy),
new SqlParameter("@TelephonyVoicePolicy", lyncUserPlan.TelephonyVoicePolicy)
);
}

View file

@ -53,8 +53,11 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
List<string> resSettings = new List<string>(lyncSettings);
ExtendLyncSettings(resSettings, "primarydomaincontroller", GetProviderProperty(organizationServiceId, "primarydomaincontroller"));
ExtendLyncSettings(resSettings, "rootou", GetProviderProperty(organizationServiceId, "rootou"));
if (organizationServiceId != -1)
{
ExtendLyncSettings(resSettings, "primarydomaincontroller", GetProviderProperty(organizationServiceId, "primarydomaincontroller"));
ExtendLyncSettings(resSettings, "rootou", GetProviderProperty(organizationServiceId, "rootou"));
}
ws.ServiceProviderSettingsSoapHeaderValue.Settings = resSettings.ToArray();
return ws;
}
@ -345,6 +348,13 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "SET_LYNC_USER_GENERAL_SETTINGS");
string PIN = "";
string[] uriAndPin = ("" + lineUri).Split(':');
if (uriAndPin.Length > 0) lineUri = uriAndPin[0];
if (uriAndPin.Length > 1) PIN = uriAndPin[1];
LyncUser user = null;
try
@ -378,20 +388,22 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
if (!string.IsNullOrEmpty(sipAddress))
{
if (sipAddress != usr.UserPrincipalName)
if (user.SipAddress != sipAddress)
{
if (DataProvider.LyncUserExists(accountId, sipAddress))
if (sipAddress != usr.UserPrincipalName)
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.ADDRESS_ALREADY_USED);
return res;
if (DataProvider.LyncUserExists(accountId, sipAddress))
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.ADDRESS_ALREADY_USED);
return res;
}
}
user.SipAddress = sipAddress;
}
user.SipAddress = sipAddress;
}
if (!string.IsNullOrEmpty(lineUri)) user.LineUri = lineUri;
user.LineUri = lineUri;
user.PIN = PIN;
lync.SetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName, user);
@ -1002,6 +1014,51 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
#endregion
public static string[] GetPolicyList(int itemId, LyncPolicyType type, string name)
{
string[] ret = null;
try
{
if (itemId == -1)
{
// policy list in all lync servers
List<string> allpolicylist = new List<string>();
List<ServerInfo> servers = ServerController.GetAllServers();
foreach (ServerInfo server in servers)
{
List<ServiceInfo> services = ServerController.GetServicesByServerIdGroupName(server.ServerId, ResourceGroups.Lync);
foreach (ServiceInfo service in services)
{
LyncServer lync = GetLyncServer(service.ServiceId, -1);
string[] values = lync.GetPolicyList(type, name);
foreach (string val in values)
if (allpolicylist.IndexOf(val) == -1)
allpolicylist.Add(val);
}
}
ret = allpolicylist.ToArray();
}
else
{
Organization org = (Organization)PackageController.GetPackageItem(itemId);
int lyncServiceId = GetLyncServiceID(org.PackageId);
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
ret = lync.GetPolicyList(type, name);
}
}
catch (Exception ex)
{
}
finally
{
}
return ret;
}
#region Private methods
public static UInt64 ConvertPhoneNumberToLong(string ip)

View file

@ -965,38 +965,59 @@ namespace WebsitePanel.EnterpriseServer
return res;
}
var startExternalIP = IPAddress.Parse(externalIP);
var startInternalIP = IPAddress.Parse(internalIP);
var endExternalIP = IPAddress.Parse(endIP);
// handle CIDR notation IP/Subnet addresses
if (startExternalIP.IsSubnet && endExternalIP == null) {
endExternalIP = startExternalIP.LastSubnetIP;
startExternalIP = startExternalIP.FirstSubnetIP;
}
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;
long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1;
while (true)
if (pool == IPAddressPool.PhoneNumbers)
{
if (i > MaxSubnet)
break;
string phoneFormat = "D" + Math.Max(externalIP.Length, endIP.Length);
// add IP address
DataProvider.AddIPAddress((int)pool, serverId, startExternalIP.ToString(), startInternalIP.ToString(), subnetMask, defaultGateway, comments);
UInt64 start = UInt64.Parse(externalIP);
UInt64 end = UInt64.Parse(endIP);
if (startExternalIP == endExternalIP)
break;
if (end < start) { UInt64 temp = start; start = end; end = temp; }
i++;
const UInt64 maxPhones = 1000; // TODO max?
startExternalIP += step;
end = Math.Min(end, start + maxPhones);
if (startInternalIP != 0)
startInternalIP += step;
for (UInt64 number = start; number <= end; number++)
DataProvider.AddIPAddress((int)pool, serverId, number.ToString(phoneFormat), "", subnetMask, defaultGateway, comments);
}
else
{
var startExternalIP = IPAddress.Parse(externalIP);
var startInternalIP = IPAddress.Parse(internalIP);
var endExternalIP = IPAddress.Parse(endIP);
// handle CIDR notation IP/Subnet addresses
if (startExternalIP.IsSubnet && endExternalIP == null)
{
endExternalIP = startExternalIP.LastSubnetIP;
startExternalIP = startExternalIP.FirstSubnetIP;
}
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;
long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1;
while (true)
{
if (i > MaxSubnet)
break;
// add IP address
DataProvider.AddIPAddress((int)pool, serverId, startExternalIP.ToString(), startInternalIP.ToString(), subnetMask, defaultGateway, comments);
if (startExternalIP == endExternalIP)
break;
i++;
startExternalIP += step;
if (startInternalIP != 0)
startInternalIP += step;
}
}
}
catch (Exception ex)