merge
This commit is contained in:
commit
6502d76513
27 changed files with 1551 additions and 77 deletions
|
@ -66,12 +66,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static ResultObject DeleteEnterpriseStorage(int packageId, int itemId)
|
||||
{
|
||||
return DeleteEnterpriseStorageInternal(packageId,itemId);
|
||||
return DeleteEnterpriseStorageInternal(packageId, itemId);
|
||||
}
|
||||
|
||||
public static SystemFile[] GetFolders(int itemId)
|
||||
{
|
||||
return GetFoldersInternal(itemId);
|
||||
return GetFoldersInternal(itemId);
|
||||
}
|
||||
|
||||
public static SystemFile GetFolder(int itemId, string folderName)
|
||||
|
@ -102,7 +102,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public static ResultObject DeleteFolder(int itemId, string folderName)
|
||||
{
|
||||
return DeleteFolderInternal(itemId, folderName);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ExchangeAccount> SearchESAccounts(int itemId, string filterColumn, string filterValue, string sortColumn)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static ESPermission[] GetFolderPermission(int itemId, string folder)
|
||||
{
|
||||
return ConvertToESPermission(itemId,GetFolderWebDavRulesInternal(itemId, folder));
|
||||
return ConvertToESPermission(itemId, GetFolderWebDavRulesInternal(itemId, folder));
|
||||
}
|
||||
|
||||
public static bool CheckFileServicesInstallation(int serviceId)
|
||||
|
@ -144,7 +144,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static bool GetDirectoryBrowseEnabled(int itemId, string siteId)
|
||||
{
|
||||
return GetDirectoryBrowseEnabledInternal(itemId, siteId);
|
||||
return GetDirectoryBrowseEnabledInternal(itemId, siteId);
|
||||
}
|
||||
|
||||
public static void SetDirectoryBrowseEnabled(int itemId, string siteId, bool enabled)
|
||||
|
@ -164,10 +164,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public static int DeleteWebDavDirectory(int packageId, string site, string vdirName)
|
||||
{
|
||||
return DeleteWebDavDirectoryInternal(packageId, site, vdirName);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
protected static bool CheckUsersDomainExistsInternal(int itemId)
|
||||
|
@ -227,7 +227,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
string usersDomain = esSesstings["UsersDomain"];
|
||||
|
||||
WebServer web = GetWebServer(packageId);
|
||||
|
||||
|
||||
if (!web.VirtualDirectoryExists(usersDomain, org.OrganizationId))
|
||||
{
|
||||
checkResult = false;
|
||||
|
@ -261,16 +261,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
EnterpriseStorageController.AddWebDavDirectory(packageId, usersDomain, org.OrganizationId, homePath);
|
||||
|
||||
int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
bool enableHardQuota = (esSesstings["enablehardquota"] != null)
|
||||
? bool.Parse(esSesstings["enablehardquota"])
|
||||
: false;
|
||||
//int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
//bool enableHardQuota = (esSesstings["enablehardquota"] != null)
|
||||
// ? bool.Parse(esSesstings["enablehardquota"])
|
||||
// : false;
|
||||
|
||||
if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId))
|
||||
{
|
||||
FilesController.SetFolderQuota(packageId, Path.Combine(usersHome, org.OrganizationId),
|
||||
locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE);
|
||||
}
|
||||
//if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId))
|
||||
//{
|
||||
// FilesController.SetFolderQuota(packageId, Path.Combine(usersHome, org.OrganizationId),
|
||||
// locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE);
|
||||
//}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -347,7 +347,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
return null;
|
||||
return new SystemFile[0];
|
||||
}
|
||||
|
||||
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
|
||||
|
@ -418,6 +418,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
|
||||
|
||||
es.CreateFolder(org.OrganizationId, folderName);
|
||||
|
||||
UpdateESHardQuota(org.PackageId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -473,7 +475,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected static List<ExchangeAccount> SearchESAccountsInternal(int itemId, string filterColumn, string filterValue, string sortColumn)
|
||||
{
|
||||
// load organization
|
||||
|
@ -547,7 +549,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#region WebDav
|
||||
|
||||
protected static int AddWebDavDirectoryInternal(int packageId, string site, string vdirName, string contentpath)
|
||||
|
@ -579,11 +581,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
dir.HttpErrors = null;
|
||||
dir.MimeMaps = null;
|
||||
|
||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web);
|
||||
|
||||
if (serviceId == -1)
|
||||
return serviceId;
|
||||
|
||||
// create directory
|
||||
|
||||
WebServer web = GetWebServer(packageId);
|
||||
|
@ -755,7 +752,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
var account = ObjectUtils.FillObjectFromDataReader<ExchangeAccount>(DataProvider.GetExchangeAccountByAccountName(itemId, permission.Account));
|
||||
|
||||
if (account.AccountType == ExchangeAccountType.SecurityGroup
|
||||
if (account.AccountType == ExchangeAccountType.SecurityGroup
|
||||
|| account.AccountType == ExchangeAccountType.DefaultSecurityGroup)
|
||||
{
|
||||
rule.Roles.Add(permission.Account);
|
||||
|
@ -838,6 +835,33 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
}
|
||||
|
||||
private static void UpdateESHardQuota(int packageId)
|
||||
{
|
||||
int esServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.EnterpriseStorage);
|
||||
|
||||
if (esServiceId != 0)
|
||||
{
|
||||
|
||||
StringDictionary esSesstings = ServerController.GetServiceSettings(esServiceId);
|
||||
|
||||
string usersHome = esSesstings["UsersHome"];
|
||||
string usersDomain = esSesstings["UsersDomain"];
|
||||
string locationDrive = esSesstings["LocationDrive"];
|
||||
|
||||
string homePath = string.Format("{0}:\\{1}", locationDrive, usersHome);
|
||||
|
||||
int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
bool enableHardQuota = (esSesstings["enablehardquota"] != null)
|
||||
? bool.Parse(esSesstings["enablehardquota"])
|
||||
: false;
|
||||
|
||||
if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId))
|
||||
{
|
||||
FilesController.SetFolderQuota(packageId, usersHome, locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get webserver (IIS) installed on server connected with packageId
|
||||
/// </summary>
|
||||
|
@ -847,15 +871,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
try
|
||||
{
|
||||
var group = ServerController.GetResourceGroupByName(ResourceGroups.Web);
|
||||
var webGroup = ServerController.GetResourceGroupByName(ResourceGroups.Web);
|
||||
var webProviders = ServerController.GetProvidersByGroupID(webGroup.GroupId);
|
||||
var esServiceInfo = ServerController.GetServiceInfo(GetEnterpriseStorageServiceID(packageId));
|
||||
|
||||
var webProviders = ServerController.GetProvidersByGroupID(group.GroupId);
|
||||
|
||||
var package = PackageController.GetPackage(packageId);
|
||||
var serverId = esServiceInfo.ServerId;
|
||||
|
||||
foreach (var webProvider in webProviders)
|
||||
{
|
||||
BoolResult result = ServerController.IsInstalled(package.ServerId, webProvider.ProviderId);
|
||||
BoolResult result = ServerController.IsInstalled(serverId, webProvider.ProviderId);
|
||||
|
||||
if (result.IsSuccess && result.Value)
|
||||
{
|
||||
|
@ -867,7 +891,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
cnfg.ProviderSettings.ProviderName = webProvider.DisplayName;
|
||||
cnfg.ProviderSettings.ProviderType = webProvider.ProviderType;
|
||||
|
||||
ServiceProviderProxy.ServerInit(web, cnfg, package.ServerId);
|
||||
//// set service settings
|
||||
//StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId);
|
||||
//foreach (string key in serviceSettings.Keys)
|
||||
// cnfg.ProviderSettings.Settings[key] = serviceSettings[key];
|
||||
|
||||
ServiceProviderProxy.ServerInit(web, cnfg, serverId);
|
||||
|
||||
return web;
|
||||
}
|
||||
|
|
|
@ -1235,7 +1235,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
DataProvider.DeleteExchangeAccount(itemId, accountId);
|
||||
}
|
||||
|
||||
/*
|
||||
private static string BuildAccountName(string orgId, string name)
|
||||
{
|
||||
string accountName = name = name.Replace(" ", "");
|
||||
|
@ -1271,7 +1271,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -3041,7 +3041,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (idx > -1)
|
||||
name = email.Substring(0, idx);
|
||||
|
||||
string accountName = BuildAccountName(org.OrganizationId, name);
|
||||
string accountName = OrganizationController.BuildAccountNameEx(org, name);
|
||||
|
||||
// add contact
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
|
@ -3375,7 +3375,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
|
||||
if (packageCheck < 0) return packageCheck;
|
||||
|
||||
string accountName = OrganizationController.BuildAccountNameWithOrgId(org.OrganizationId, name, org.ServiceId);
|
||||
string accountName = OrganizationController.BuildAccountNameEx(org, name);
|
||||
|
||||
// add account
|
||||
// add contact
|
||||
|
@ -4179,7 +4179,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (String.IsNullOrEmpty(name))
|
||||
name = Utils.CleanIdentifier(folderName);
|
||||
|
||||
string accountName = BuildAccountName(org.OrganizationId, name);
|
||||
string accountName = OrganizationController.BuildAccountNameEx(org, name);
|
||||
|
||||
// add mailbox
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
|
@ -4324,7 +4324,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (EmailAddressExists(email))
|
||||
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
|
||||
|
||||
string accountName = BuildAccountName(org.OrganizationId, name);
|
||||
string accountName = OrganizationController.BuildAccountNameEx(org, name);
|
||||
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||
|
|
|
@ -397,7 +397,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
foreach (AdditionalGroup additionalGroup in GetAdditionalGroups(settings.UserId))
|
||||
{
|
||||
string additionalGroupName = BuildAccountNameWithOrgId(org.OrganizationId, additionalGroup.GroupName.Replace(" ", ""), org.ServiceId);
|
||||
string additionalGroupName = BuildAccountNameEx(org, additionalGroup.GroupName.Replace(" ", ""));
|
||||
|
||||
if (orgProxy.CreateSecurityGroup(org.OrganizationId, additionalGroupName) == 0)
|
||||
{
|
||||
|
@ -1383,7 +1383,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
|
||||
|
||||
// load organization
|
||||
Organization org = GetOrganization(itemId);
|
||||
WebsitePanel.Providers.HostedSolution.Organization org = GetOrganization(itemId);
|
||||
|
||||
if (org == null)
|
||||
{
|
||||
|
@ -1408,7 +1408,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
|
||||
|
||||
string upn = string.Format("{0}@{1}", name, domain);
|
||||
string sAMAccountName = AppendOrgId(serviceSettings) ? BuildAccountNameWithOrgId(org.OrganizationId, name, org.ServiceId) : BuildAccountName(org.OrganizationId, name, org.ServiceId);
|
||||
string sAMAccountName = BuildAccountNameEx(org, name);
|
||||
|
||||
TaskManager.Write("accountName :" + sAMAccountName);
|
||||
TaskManager.Write("upn :" + upn);
|
||||
|
@ -1446,6 +1446,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return userId;
|
||||
}
|
||||
|
||||
|
||||
public static string BuildAccountNameEx(Organization org, string name)
|
||||
{
|
||||
StringDictionary serviceSettings = ServerController.GetServiceSettings(org.ServiceId);
|
||||
|
||||
return AppendOrgId(serviceSettings) ? BuildAccountNameWithOrgId(org.OrganizationId, name, org.ServiceId) : BuildAccountName(org.OrganizationId, name, org.ServiceId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Checks should or not user name include organization id. </summary>
|
||||
/// <param name="serviceSettings"> The service settings. </param>
|
||||
/// <returns> True - if organization id should be appended. </returns>
|
||||
|
@ -2370,8 +2379,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
|
||||
|
||||
string groupName = BuildAccountNameWithOrgId(org.OrganizationId, displayName.Replace(" ", ""), org.ServiceId);
|
||||
|
||||
string groupName = BuildAccountNameEx(org, displayName.Replace(" ", ""));
|
||||
|
||||
TaskManager.Write("accountName :" + groupName);
|
||||
|
||||
if (orgProxy.CreateSecurityGroup(org.OrganizationId, groupName) == 0)
|
||||
|
|
|
@ -489,7 +489,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (createInstantAlias)
|
||||
ServerController.CreateDomainInstantAlias("", domainId);
|
||||
|
||||
|
@ -994,7 +994,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
DataProvider.UpdatePackageBandwidthUpdate(packageId, updateDate);
|
||||
}
|
||||
|
||||
|
||||
// This gets the system quota and updates the home folder with the value
|
||||
public static void UpdatePackageHardQuota(int packageId)
|
||||
{
|
||||
|
@ -1019,6 +1019,33 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
}
|
||||
|
||||
//public static void UpdateESHardQuota(int packageId)
|
||||
//{
|
||||
// int esServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.EnterpriseStorage);
|
||||
|
||||
// if (esServiceId != 0)
|
||||
// {
|
||||
|
||||
// StringDictionary esSesstings = ServerController.GetServiceSettings(esServiceId);
|
||||
|
||||
// string usersHome = esSesstings["UsersHome"];
|
||||
// string usersDomain = esSesstings["UsersDomain"];
|
||||
// string locationDrive = esSesstings["LocationDrive"];
|
||||
|
||||
// string homePath = string.Format("{0}:\\{1}", locationDrive, usersHome);
|
||||
|
||||
// int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
// bool enableHardQuota = (esSesstings["enablehardquota"] != null)
|
||||
// ? bool.Parse(esSesstings["enablehardquota"])
|
||||
// : false;
|
||||
|
||||
// if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId))
|
||||
// {
|
||||
// FilesController.SetFolderQuota(packageId, usersHome, locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Package Add-ons
|
||||
|
@ -1061,7 +1088,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (result.Result < 0)
|
||||
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
|
||||
| DemandAccount.IsResellerCSR);
|
||||
|
||||
|
||||
if (result.Result < 0) return result;
|
||||
|
||||
int addonId = 0;
|
||||
|
@ -1108,7 +1135,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
|
||||
UpdatePackageHardQuota(addon.PackageId);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1119,12 +1145,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
| DemandAccount.IsReseller);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
|
||||
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
|
||||
UpdatePackageHardQuota(GetPackageAddon(packageAddonId).PackageId);
|
||||
var packageId = GetPackageAddon(packageAddonId).PackageId;
|
||||
|
||||
DataProvider.DeletePackageAddon(SecurityContext.User.UserId, packageAddonId);
|
||||
|
||||
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
|
||||
UpdatePackageHardQuota(packageId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2075,7 +2102,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
}
|
||||
items["Addons"] = addOns;
|
||||
|
||||
|
||||
// package contexts
|
||||
Hashtable cntxs = new Hashtable();
|
||||
foreach (PackageInfo package in packages)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue