partial commit

This commit is contained in:
robvde 2012-12-22 05:01:28 +04:00
parent 57483fbf7f
commit d5f30bf493
7 changed files with 186 additions and 22 deletions

View file

@ -37,6 +37,7 @@ namespace WebsitePanel.Providers.HostedSolution
public string DisplayName{ get; set; } public string DisplayName{ get; set; }
public DateTime AccountCreated { get; set; } public DateTime AccountCreated { get; set; }
public string PrimaryEmailAddress { get; set; } public string PrimaryEmailAddress { get; set; }
public bool LitigationHoldEnabled { get; set; }
public bool POPEnabled { get; set; } public bool POPEnabled { get; set; }
public bool IMAPEnabled { get; set; } public bool IMAPEnabled { get; set; }
public bool OWAEnabled { get; set; } public bool OWAEnabled { get; set; }
@ -45,6 +46,9 @@ namespace WebsitePanel.Providers.HostedSolution
public int TotalItems { get; set; } public int TotalItems { get; set; }
public long TotalSize { get; set; } public long TotalSize { get; set; }
public long MaxSize { get; set; } public long MaxSize { get; set; }
public long LitigationHoldTotalSize { get; set; }
public long LitigationHoldTotalItems { get; set; }
public long LitigationHoldMaxSize { get; set; }
public DateTime LastLogon { get; set; } public DateTime LastLogon { get; set; }
public DateTime LastLogoff { get; set; } public DateTime LastLogoff { get; set; }
public bool Enabled { get; set; } public bool Enabled { get; set; }

View file

@ -2795,7 +2795,7 @@ namespace WebsitePanel.Providers.HostedSolution
return type; return type;
} }
private ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id) virtual internal ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id)
{ {
ExchangeLog.LogStart("GetMailboxStatisticsInternal"); ExchangeLog.LogStart("GetMailboxStatisticsInternal");
ExchangeLog.DebugInfo("Account: {0}", id); ExchangeLog.DebugInfo("Account: {0}", id);

View file

@ -160,6 +160,89 @@ namespace WebsitePanel.Providers.HostedSolution
} }
internal override ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id)
{
ExchangeLog.LogStart("GetMailboxStatisticsInternal");
ExchangeLog.DebugInfo("Account: {0}", id);
ExchangeMailboxStatistics info = new ExchangeMailboxStatistics();
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
Collection<PSObject> result = GetMailboxObject(runSpace, id);
PSObject mailbox = result[0];
string dn = GetResultObjectDN(result);
string path = AddADPrefix(dn);
DirectoryEntry entry = GetADObject(path);
info.Enabled = !(bool)entry.InvokeGet("AccountDisabled");
info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress");
if (smtpAddress != null)
info.PrimaryEmailAddress = smtpAddress.ToString();
info.MaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota"));
info.LitigationHoldMaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota"));
DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated");
info.AccountCreated = ConvertNullableToDateTime(whenCreated);
//Client Access
Command cmd = new Command("Get-CASMailbox");
cmd.Parameters.Add("Identity", id);
result = ExecuteShellCommand(runSpace, cmd);
mailbox = result[0];
info.ActiveSyncEnabled = (bool)GetPSObjectProperty(mailbox, "ActiveSyncEnabled");
info.OWAEnabled = (bool)GetPSObjectProperty(mailbox, "OWAEnabled");
info.MAPIEnabled = (bool)GetPSObjectProperty(mailbox, "MAPIEnabled");
info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");
//Statistics
cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", id);
result = ExecuteShellCommand(runSpace, cmd);
if (result.Count > 0)
{
PSObject statistics = result[0];
Unlimited<ByteQuantifiedSize> totalItemSize = (Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(statistics, "TotalItemSize");
info.TotalSize = ConvertUnlimitedToBytes(totalItemSize);
uint? itemCount = (uint?)GetPSObjectProperty(statistics, "ItemCount");
info.TotalItems = ConvertNullableToInt32(itemCount);
totalItemSize = (Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(statistics, "FolderAndSubfolderSize");
info.LitigationHoldTotalSize = ConvertUnlimitedToBytes(totalItemSize);
itemCount = (uint?)GetPSObjectProperty(statistics, "ItemsInFolder");
info.LitigationHoldTotalItems = ConvertNullableToInt32(itemCount);
DateTime? lastLogoffTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogoffTime");
DateTime? lastLogonTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogonTime");
info.LastLogoff = ConvertNullableToDateTime(lastLogoffTime);
info.LastLogon = ConvertNullableToDateTime(lastLogonTime);
}
else
{
info.TotalSize = 0;
info.TotalItems = 0;
info.LastLogoff = DateTime.MinValue;
info.LastLogon = DateTime.MinValue;
}
}
finally
{
CloseRunspace(runSpace);
}
ExchangeLog.LogEnd("GetMailboxStatisticsInternal");
return info;
}
internal override void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP, internal override void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP,
bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB,

View file

@ -159,4 +159,13 @@
<data name="valRequireDisplayName.Text" xml:space="preserve"> <data name="valRequireDisplayName.Text" xml:space="preserve">
<value>*</value> <value>*</value>
</data> </data>
<data name="chkEnableLitigationHold.Text" xml:space="preserve">
<value>Enable Litigation Hold</value>
</data>
<data name="locLitigationHoldSpace.Text" xml:space="preserve">
<value>Litigation Hold Space:</value>
</data>
<data name="secLitigationHoldSettings.Text" xml:space="preserve">
<value>Litigation Hold Settings</value>
</data>
</root> </root>

View file

@ -32,9 +32,7 @@
<wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_settings" /> <wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_settings" />
<wsp:SimpleMessageBox id="messageBox" runat="server" /> <wsp:SimpleMessageBox id="messageBox" runat="server" />
<wsp:CollapsiblePanel id="secGeneral" runat="server" <wsp:CollapsiblePanel id="secGeneral" runat="server" TargetControlID="General" meta:resourcekey="secGeneral" Text="General"></wsp:CollapsiblePanel>
TargetControlID="General" meta:resourcekey="secGeneral" Text="General">
</wsp:CollapsiblePanel>
<asp:Panel ID="General" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="General" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate> <ContentTemplate>
@ -71,14 +69,35 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secCalendarSettings" runat="server" <wsp:CollapsiblePanel id="secLitigationHoldSettings" runat="server" TargetControlID="LitigationHoldSettings" meta:resourcekey="secGeneral" Text="General"></wsp:CollapsiblePanel>
TargetControlID="CalendarSettings" meta:resourcekey="secCalendarSettings" Text="General"> <asp:Panel ID="LitigationHoldSettings" runat="server" Height="0" style="overflow:hidden;">
</wsp:CollapsiblePanel> <asp:UpdatePanel ID="LitigationHoldUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<table>
<tr>
<td></td>
<td>
<asp:CheckBox ID="chkEnableLitigationHold" runat="server" meta:resourcekey="chkEnableLitigationHold" Text="Enable Litigation Hold" />
<br />
<br />
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="locLitigationHoldSpace" runat="server" meta:resourcekey="locLitigationHoldSpace" Text="Litigation Hold Space:"></asp:Localize></td>
<td>
<wsp:QuotaViewer ID="litigationHoldSpace" runat="server" QuotaTypeId="2" DisplayGauge="true" /> MB
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<wsp:CollapsiblePanel id="secCalendarSettings" runat="server" TargetControlID="CalendarSettings" meta:resourcekey="secCalendarSettings" Text="General"></wsp:CollapsiblePanel>
<asp:Panel ID="CalendarSettings" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="CalendarSettings" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate> <ContentTemplate>
<table> <table>
</table> </table>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>

View file

@ -50,8 +50,9 @@ namespace WebsitePanel.Portal.ExchangeServer
chkHideAddressBook.Visible = false; chkHideAddressBook.Visible = false;
chkDisable.Visible = false; chkDisable.Visible = false;
} }
}
secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, cntx));
}
} }
} }
@ -99,10 +100,13 @@ namespace WebsitePanel.Portal.ExchangeServer
mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024); mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024);
mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1: (int)Math.Round((double)(stats.MaxSize / 1024 / 1024)); mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1: (int)Math.Round((double)(stats.MaxSize / 1024 / 1024));
if ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room)) secCalendarSettings.Visible = ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room));
secCalendarSettings.Visible = true;
else chkEnableLitigationHold.Checked = mailbox.EnableLitigationHold;
secCalendarSettings.Visible = false;
litigationHoldSpace.QuotaUsedValue = Convert.ToInt32(stats.LitigationHoldTotalSize / 1024 / 1024);
litigationHoldSpace.QuotaValue = (stats.LitigationHoldMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.LitigationHoldMaxSize / 1024 / 1024));
} }

View file

@ -165,6 +165,60 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer mailboxSize; protected global::WebsitePanel.Portal.QuotaViewer mailboxSize;
/// <summary>
/// secLitigationHoldSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secLitigationHoldSettings;
/// <summary>
/// LitigationHoldSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel LitigationHoldSettings;
/// <summary>
/// LitigationHoldUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel LitigationHoldUpdatePanel;
/// <summary>
/// chkEnableLitigationHold control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkEnableLitigationHold;
/// <summary>
/// locLitigationHoldSpace control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locLitigationHoldSpace;
/// <summary>
/// litigationHoldSpace control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer litigationHoldSpace;
/// <summary> /// <summary>
/// secCalendarSettings control. /// secCalendarSettings control.
/// </summary> /// </summary>
@ -218,14 +272,5 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
/// <summary>
/// FormComments control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize FormComments;
} }
} }