Merge
This commit is contained in:
commit
e9c7b0868b
580 changed files with 247313 additions and 5211 deletions
|
@ -1197,6 +1197,24 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@itemName", itemName));
|
||||
}
|
||||
|
||||
public static int GetServiceItemsCountByNameAndServiceId(int actorId, int serviceId, string groupName,
|
||||
string itemName, string itemTypeName)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
object obj = SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetServiceItemsCountByNameAndServiceId",
|
||||
new SqlParameter("@ActorID", actorId),
|
||||
new SqlParameter("@ServiceId", serviceId),
|
||||
new SqlParameter("@ItemName", itemName),
|
||||
new SqlParameter("@GroupName", groupName),
|
||||
new SqlParameter("@ItemTypeName", itemTypeName));
|
||||
|
||||
if (!int.TryParse(obj.ToString(), out res)) return -1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static int AddServiceItem(int actorId, int serviceId, int packageId, string itemName,
|
||||
string itemTypeName, string xmlProperties)
|
||||
{
|
||||
|
@ -2684,13 +2702,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeAccountByAccountNameWithoutItemId(string primaryEmailAddress)
|
||||
public static IDataReader GetExchangeAccountByAccountNameWithoutItemId(string userPrincipalName)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccountByAccountNameWithoutItemId",
|
||||
new SqlParameter("@PrimaryEmailAddress", primaryEmailAddress)
|
||||
new SqlParameter("@UserPrincipalName", userPrincipalName)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4486,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
|
||||
|
|
|
@ -125,8 +125,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (serviceId == 0)
|
||||
return BusinessErrorCodes.ERROR_MSSQL_RESOURCE_UNAVAILABLE;
|
||||
|
||||
// check package items
|
||||
if (PackageController.GetPackageItemByName(item.PackageId, groupName, item.Name, typeof(SqlDatabase)) != null)
|
||||
// check service items
|
||||
if (PackageController.GetServiceItemsCountByNameAndServiceId(serviceId, groupName, item.Name, typeof(SqlDatabase)) > 0)
|
||||
return BusinessErrorCodes.ERROR_MSSQL_DATABASES_PACKAGE_ITEM_EXISTS;
|
||||
|
||||
// place log record
|
||||
|
|
|
@ -272,6 +272,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
// delete service item
|
||||
PackageController.DeletePackageItem(zoneItemId);
|
||||
|
||||
// Delete also all seconday service items
|
||||
var zoneItems = PackageController.GetPackageItemsByType(zoneItem.PackageId, ResourceGroups.Dns, typeof (SecondaryDnsZone));
|
||||
|
||||
foreach (var item in zoneItems.Where(z => z.Name == zoneItem.Name))
|
||||
{
|
||||
PackageController.DeletePackageItem(item.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -172,6 +172,34 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return ObjectUtils.FillObjectFromDataReader<WebDavAccessToken>(DataProvider.GetWebDavAccessTokenByAccessToken(accessToken));
|
||||
}
|
||||
|
||||
public static SystemFile[] SearchFiles(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive)
|
||||
{
|
||||
try
|
||||
{
|
||||
// load organization
|
||||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
return new SystemFile[0];
|
||||
}
|
||||
|
||||
int serviceId = GetEnterpriseStorageServiceID(org.PackageId);
|
||||
|
||||
if (serviceId == 0)
|
||||
{
|
||||
return new SystemFile[0];
|
||||
}
|
||||
|
||||
EnterpriseStorage es = GetEnterpriseStorage(serviceId);
|
||||
|
||||
return es.Search(org.OrganizationId, searchPaths, searchText, userPrincipalName, recursive);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
#region Directory Browsing
|
||||
|
||||
public static bool GetDirectoryBrowseEnabled(int itemId, string siteId)
|
||||
|
@ -202,6 +230,33 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
private static IEnumerable<SystemFile> GetRootFolders(string userPrincipalName)
|
||||
{
|
||||
var rootFolders = new List<SystemFile>();
|
||||
|
||||
var account = ExchangeServerController.GetAccountByAccountName(userPrincipalName);
|
||||
|
||||
var userGroups = OrganizationController.GetSecurityGroupsByMember(account.ItemId, account.AccountId);
|
||||
|
||||
foreach (var folder in GetFolders(account.ItemId))
|
||||
{
|
||||
var permissions = GetFolderPermission(account.ItemId, folder.Name);
|
||||
|
||||
foreach (var permission in permissions)
|
||||
{
|
||||
if ((!permission.IsGroup
|
||||
&& (permission.DisplayName == account.UserPrincipalName || permission.DisplayName == account.DisplayName))
|
||||
|| (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName)))
|
||||
{
|
||||
rootFolders.Add(folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rootFolders;
|
||||
}
|
||||
|
||||
protected static void StartESBackgroundTaskInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions, bool directoyBrowsingEnabled, int quota, QuotaType quotaType)
|
||||
{
|
||||
// load organization
|
||||
|
@ -1210,6 +1265,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)
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Threading;
|
||||
using WebsitePanel.EnterpriseServer.Code.HostedSolution;
|
||||
|
@ -1216,10 +1217,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return account;
|
||||
}
|
||||
|
||||
public static ExchangeAccount GetAccountByAccountName(string primaryEmailAddress)
|
||||
public static ExchangeAccount GetAccountByAccountName(string userPrincipalName)
|
||||
{
|
||||
ExchangeAccount account = ObjectUtils.FillObjectFromDataReader<ExchangeAccount>(
|
||||
DataProvider.GetExchangeAccountByAccountNameWithoutItemId(primaryEmailAddress));
|
||||
DataProvider.GetExchangeAccountByAccountNameWithoutItemId(userPrincipalName));
|
||||
|
||||
if (account == null)
|
||||
return null;
|
||||
|
@ -2919,23 +2920,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
try
|
||||
{
|
||||
List<ExchangeMailboxPlan> mailboxPlans = new List<ExchangeMailboxPlan>();
|
||||
int? defaultPlanId = null;
|
||||
|
||||
UserInfo user = ObjectUtils.FillObjectFromDataReader<UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));
|
||||
|
||||
if (user.Role == UserRole.User)
|
||||
ExchangeServerController.GetExchangeMailboxPlansByUser(itemId, user, ref mailboxPlans, archiving);
|
||||
GetExchangeMailboxPlansByUser(itemId, user, ref mailboxPlans, ref defaultPlanId, archiving);
|
||||
else
|
||||
ExchangeServerController.GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans, archiving);
|
||||
GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans, ref defaultPlanId, archiving);
|
||||
|
||||
|
||||
ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader<ExchangeOrganization>(DataProvider.GetExchangeOrganization(itemId));
|
||||
|
||||
if (ExchangeOrg != null)
|
||||
if (defaultPlanId.HasValue)
|
||||
{
|
||||
foreach (ExchangeMailboxPlan p in mailboxPlans)
|
||||
{
|
||||
p.IsDefault = (p.MailboxPlanId == ExchangeOrg.ExchangeMailboxPlanID);
|
||||
}
|
||||
mailboxPlans.ForEach(p => p.IsDefault = (p.MailboxPlanId == defaultPlanId.Value));
|
||||
}
|
||||
|
||||
return mailboxPlans;
|
||||
|
@ -2950,7 +2946,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
private static void GetExchangeMailboxPlansByUser(int itemId, UserInfo user, ref List<ExchangeMailboxPlan> mailboxPlans, bool archiving)
|
||||
private static void GetExchangeMailboxPlansByUser(int itemId, UserInfo user, ref List<ExchangeMailboxPlan> mailboxPlans, ref int? defaultPlanId, bool archiving)
|
||||
{
|
||||
if ((user != null))
|
||||
{
|
||||
|
@ -2983,11 +2979,20 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
mailboxPlans.Add(p);
|
||||
}
|
||||
|
||||
// Set default plan
|
||||
ExchangeOrganization exchangeOrg = ObjectUtils.FillObjectFromDataReader<ExchangeOrganization>(DataProvider.GetExchangeOrganization(OrgId));
|
||||
|
||||
// If the default plan has not been set by the setting of higher priority
|
||||
if (!defaultPlanId.HasValue && exchangeOrg != null && exchangeOrg.ExchangeMailboxPlanID > 0)
|
||||
{
|
||||
defaultPlanId = exchangeOrg.ExchangeMailboxPlanID;
|
||||
}
|
||||
}
|
||||
|
||||
UserInfo owner = UserController.GetUserInternally(user.OwnerId);
|
||||
|
||||
GetExchangeMailboxPlansByUser(0, owner, ref mailboxPlans, archiving);
|
||||
GetExchangeMailboxPlansByUser(0, owner, ref mailboxPlans, ref defaultPlanId, archiving);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5532,7 +5537,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
res += id + " has a value \"" + defaultPublicFoldes[0] + "\"" + Environment.NewLine;
|
||||
|
||||
if (defaultPublicFoldes.Length == 2)
|
||||
res += id + " changed from \"" + defaultPublicFoldes[0] + "\" to \"" + defaultPublicFoldes[1] + "\"" + Environment.NewLine;
|
||||
res += id + " changed \"" + defaultPublicFoldes[0] + "\" to \"" + defaultPublicFoldes[1] + "\"" + Environment.NewLine;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2284,7 +2284,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
string lastName, string address, string city, string state, string zip, string country,
|
||||
string jobTitle, string company, string department, string office, string managerAccountName,
|
||||
string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
|
||||
string webPage, string notes, string externalEmail, string subscriberNumber, int levelId, bool isVIP)
|
||||
string webPage, string notes, string externalEmail, string subscriberNumber, int levelId, bool isVIP,
|
||||
bool userMustChangePassword)
|
||||
{
|
||||
|
||||
// check account
|
||||
|
@ -2346,7 +2347,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
pager,
|
||||
webPage,
|
||||
notes,
|
||||
externalEmailAddress);
|
||||
externalEmailAddress,
|
||||
userMustChangePassword);
|
||||
|
||||
// update account
|
||||
account.DisplayName = displayName;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1380,6 +1380,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return CreateServiceItem(dvItem[0], dsItem.Tables[1].DefaultView);
|
||||
}
|
||||
|
||||
public static int GetServiceItemsCountByNameAndServiceId(int serviceId, string groupName, string itemName, Type itemType)
|
||||
{
|
||||
string itemTypeName = ObjectUtils.GetTypeFullName(itemType);
|
||||
|
||||
return DataProvider.GetServiceItemsCountByNameAndServiceId(SecurityContext.User.UserId,
|
||||
serviceId, groupName, itemName, itemTypeName);
|
||||
}
|
||||
|
||||
public static bool CheckServiceItemExists(string itemName, Type itemType)
|
||||
{
|
||||
return CheckServiceItemExists(itemName, null, itemType);
|
||||
|
|
|
@ -381,7 +381,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
site.PerlInstalled = Utils.ParseBool(webPolicy["PerlInstalled"], false);
|
||||
site.PythonInstalled = Utils.ParseBool(webPolicy["PythonInstalled"], false);
|
||||
site.CgiBinInstalled = Utils.ParseBool(webPolicy["CgiBinInstalled"], false);
|
||||
site.ColdFusionInstalled = false;
|
||||
QuotaValueInfo quotaInfoCF = PackageController.GetPackageQuota(packageId, Quotas.WEB_COLDFUSION);
|
||||
site.ColdFusionInstalled = (quotaInfoCF.QuotaAllocatedValue > 0) && Utils.ParseBool(webPolicy["ColdFusionInstalled"], false);
|
||||
QuotaValueInfo quotaInfoCFV = PackageController.GetPackageQuota(packageId, Quotas.WEB_CFVIRTUALDIRS);
|
||||
site.CreateCFVirtualDirectoriesPol = (quotaInfoCFV.QuotaAllocatedValue > 0) && Utils.ParseBool(webPolicy["CreateCFVirtualDirectoriesPol"], false);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -404,6 +407,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
site.PythonInstalled = false;
|
||||
site.CgiBinInstalled = false;
|
||||
site.ColdFusionInstalled = false;
|
||||
site.CreateCFVirtualDirectoriesPol = false;
|
||||
}
|
||||
|
||||
site.HttpRedirect = "";
|
||||
|
@ -3633,6 +3637,17 @@ namespace WebsitePanel.EnterpriseServer
|
|||
WebServer server = GetWebServer(item.ServiceId);
|
||||
//
|
||||
server.RevokeWebManagementAccess(item.SiteId, accountName);
|
||||
|
||||
// Cleanup web site properties if the web management and web deploy user are the same
|
||||
if (GetNonQualifiedAccountName(accountName) == item.WebDeployPublishingAccount)
|
||||
{
|
||||
item.WebDeployPublishingAccount = String.Empty;
|
||||
item.WebDeploySitePublishingEnabled = false;
|
||||
item.WebDeploySitePublishingProfile = String.Empty;
|
||||
item.WebDeployPublishingPassword = String.Empty;
|
||||
// Put changes into effect
|
||||
PackageController.UpdatePackageItem(item);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -3644,6 +3659,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
protected static string GetNonQualifiedAccountName(string accountName)
|
||||
{
|
||||
int idx = accountName.LastIndexOf("\\");
|
||||
return (idx != -1) ? accountName.Substring(idx + 1) : accountName;
|
||||
}
|
||||
|
||||
public static ResultObject ChangeWebManagementAccessPassword(int siteItemId, string accountPassword)
|
||||
{
|
||||
ResultObject result = new ResultObject { IsSuccess = true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue