merge
This commit is contained in:
commit
1433fd46b9
317 changed files with 60097 additions and 399 deletions
|
@ -4504,6 +4504,45 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetWebDavPortalUserSettingsByAccountId(int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetWebDavPortalUsersSettingsByAccountId",
|
||||
new SqlParameter("@AccountId", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
public static int AddWebDavPortalUsersSettings(int accountId, string settings)
|
||||
{
|
||||
SqlParameter settingsId = new SqlParameter("@WebDavPortalUsersSettingsId", SqlDbType.Int);
|
||||
settingsId.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddWebDavPortalUsersSettings",
|
||||
settingsId,
|
||||
new SqlParameter("@AccountId", accountId),
|
||||
new SqlParameter("@Settings", settings)
|
||||
);
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(settingsId.Value);
|
||||
}
|
||||
|
||||
public static void UpdateWebDavPortalUsersSettings(int accountId, string settings)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"UpdateWebDavPortalUsersSettings",
|
||||
new SqlParameter("@AccountId", accountId),
|
||||
new SqlParameter("@Settings", settings)
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Support Service Levels
|
||||
|
|
|
@ -1210,6 +1210,37 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return null;
|
||||
}
|
||||
|
||||
#region WebDav portal
|
||||
|
||||
public static string GetWebDavPortalUserSettingsByAccountId(int accountId)
|
||||
{
|
||||
var dataReader = DataProvider.GetWebDavPortalUserSettingsByAccountId(accountId);
|
||||
|
||||
while (dataReader.Read())
|
||||
{
|
||||
return (string)dataReader["Settings"];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void UpdateUserSettings(int accountId, string settings)
|
||||
{
|
||||
var oldSettings = GetWebDavPortalUserSettingsByAccountId(accountId);
|
||||
|
||||
if (string.IsNullOrEmpty(oldSettings))
|
||||
{
|
||||
DataProvider.AddWebDavPortalUsersSettings(accountId, settings);
|
||||
}
|
||||
else
|
||||
{
|
||||
DataProvider.UpdateWebDavPortalUsersSettings(accountId, settings);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Statistics
|
||||
|
||||
public static OrganizationStatistics GetStatistics(int itemId)
|
||||
|
|
|
@ -137,7 +137,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return domainResult;
|
||||
|
||||
// create service item
|
||||
item.Enabled = true;
|
||||
item.MaxMailboxSize = GetMaxMailBoxSize(item.PackageId, item);
|
||||
|
||||
// add service item
|
||||
|
@ -159,7 +158,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
return BusinessErrorCodes.ERROR_MAIL_LICENSE_DOMAIN_QUOTA;
|
||||
}
|
||||
if (ex.Message != null && ex.Message.Contains("The maximum number of users for the server has been reached"))
|
||||
if (ex.Message.Contains("Password doesn't meet complexity"))
|
||||
{
|
||||
return BusinessErrorCodes.ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY;
|
||||
}
|
||||
if (ex.Message.Contains("The maximum number of users for the server has been reached"))
|
||||
{
|
||||
return BusinessErrorCodes.ERROR_MAIL_LICENSE_USERS_QUOTA;
|
||||
}
|
||||
|
@ -203,7 +206,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
MailServer mail = new MailServer();
|
||||
ServiceProviderProxy.Init(mail, origItem.ServiceId);
|
||||
item.Name = origItem.Name;
|
||||
item.Enabled = true;
|
||||
|
||||
item.MaxMailboxSize = GetMaxMailBoxSize(origItem.PackageId, item);
|
||||
|
||||
|
@ -224,6 +226,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Message.Contains("Password doesn't meet complexity"))
|
||||
{
|
||||
return BusinessErrorCodes.ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY;
|
||||
}
|
||||
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -168,9 +168,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return RemoveRdsServerFromCollectionInternal(itemId, rdsServer, rdsCollection);
|
||||
}
|
||||
|
||||
public static ResultObject RemoveRdsServerFromOrganization(int rdsServerId)
|
||||
public static ResultObject RemoveRdsServerFromOrganization(int itemId, int rdsServerId)
|
||||
{
|
||||
return RemoveRdsServerFromOrganizationInternal(rdsServerId);
|
||||
return RemoveRdsServerFromOrganizationInternal(itemId, rdsServerId);
|
||||
}
|
||||
|
||||
public static ResultObject UpdateRdsServer(RdsServer rdsServer)
|
||||
|
@ -268,6 +268,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return RestartRdsServerInternal(itemId, fqdnName);
|
||||
}
|
||||
|
||||
public static List<OrganizationUser> GetRdsCollectionLocalAdmins(int collectionId)
|
||||
{
|
||||
return GetRdsCollectionLocalAdminsInternal(collectionId);
|
||||
}
|
||||
|
||||
public static ResultObject SaveRdsCollectionLocalAdmins(OrganizationUser[] users, int collectionId)
|
||||
{
|
||||
return SaveRdsCollectionLocalAdminsInternal(users, collectionId);
|
||||
}
|
||||
|
||||
private static RdsCollection GetRdsCollectionInternal(int collectionId)
|
||||
{
|
||||
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
|
||||
|
@ -300,6 +310,66 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return collection;
|
||||
}
|
||||
|
||||
private static List<OrganizationUser> GetRdsCollectionLocalAdminsInternal(int collectionId)
|
||||
{
|
||||
var result = new List<OrganizationUser>();
|
||||
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
|
||||
var servers = ObjectUtils.CreateListFromDataReader<RdsServer>(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList();
|
||||
Organization org = OrganizationController.GetOrganization(collection.ItemId);
|
||||
|
||||
if (org == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
|
||||
|
||||
var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers;
|
||||
var organizationAdmins = rds.GetRdsCollectionLocalAdmins(servers.First().FqdName);
|
||||
|
||||
return organizationUsers.Where(o => organizationAdmins.Select(a => a.ToLower()).Contains(o.DomainUserName.ToLower())).ToList();
|
||||
}
|
||||
|
||||
private static ResultObject SaveRdsCollectionLocalAdminsInternal(OrganizationUser[] users, int collectionId)
|
||||
{
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "SAVE_LOCAL_ADMINS");
|
||||
|
||||
try
|
||||
{
|
||||
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
|
||||
Organization org = OrganizationController.GetOrganization(collection.ItemId);
|
||||
|
||||
if (org == null)
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.AddError("", new NullReferenceException("Organization not found"));
|
||||
return result;
|
||||
}
|
||||
|
||||
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
|
||||
var servers = ObjectUtils.CreateListFromDataReader<RdsServer>(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList();
|
||||
|
||||
rds.SaveRdsCollectionLocalAdmins(users, servers.Select(s => s.FqdName).ToArray());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
TaskManager.CompleteResultTask(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskManager.CompleteResultTask();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static RdsCollectionSettings GetRdsCollectionSettingsInternal(int collectionId)
|
||||
{
|
||||
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
|
||||
|
@ -960,11 +1030,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
rds.AddSessionHostFeatureToServer(rdsServer.FqdName);
|
||||
}
|
||||
|
||||
rds.MoveRdsServerToTenantOU(rdsServer.FqdName, org.OrganizationId);
|
||||
DataProvider.AddRDSServerToOrganization(itemId, serverId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER_TO_ORGANIZATION", ex);
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -981,17 +1052,29 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return result;
|
||||
}
|
||||
|
||||
private static ResultObject RemoveRdsServerFromOrganizationInternal(int rdsServerId)
|
||||
private static ResultObject RemoveRdsServerFromOrganizationInternal(int itemId, int rdsServerId)
|
||||
{
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "REMOVE_RDS_SERVER_FROM_ORGANIZATION");
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "REMOVE_RDS_SERVER_FROM_ORGANIZATION");
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
|
||||
if (org == null)
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.AddError("", new NullReferenceException("Organization not found"));
|
||||
return result;
|
||||
}
|
||||
|
||||
var rdsServer = ObjectUtils.FillObjectFromDataReader<RdsServer>(DataProvider.GetRDSServerById(rdsServerId));
|
||||
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
|
||||
rds.RemoveRdsServerFromTenantOU(rdsServer.FqdName, org.OrganizationId);
|
||||
DataProvider.RemoveRDSServerFromOrganization(rdsServerId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.AddError("REMOTE_DESKTOP_SERVICES_REMOVE_RDS_SERVER_FROM_ORGANIZATION", ex);
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -1542,7 +1625,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
foreach (var server in servers)
|
||||
{
|
||||
RemoveRdsServerFromOrganization(server.Id);
|
||||
RemoveRdsServerFromOrganization(itemId, server.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue