Merge
This commit is contained in:
commit
95ed5b88db
9 changed files with 204 additions and 183 deletions
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3633,6 +3633,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 +3655,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