update functionallity for security groups
This commit is contained in:
parent
14e505a502
commit
52cf12187f
18 changed files with 1849 additions and 979 deletions
|
@ -83,5 +83,30 @@ namespace WebsitePanel.Portal
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Security Groups
|
||||
|
||||
ExchangeAccountsPaged accounts;
|
||||
|
||||
public int GetOrganizationSecurityGroupsPagedCount(int itemId, string accountTypes,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
return accounts.RecordsCount;
|
||||
}
|
||||
|
||||
public ExchangeAccount[] GetOrganizationSecurityGroupsPaged(int itemId, string accountTypes,
|
||||
string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
accounts = ES.Services.Organizations.GetOrganizationSecurityGroupsPaged(itemId,
|
||||
filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return accounts.PageItems;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,10 +118,10 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="btnCreate.OnClientClick" xml:space="preserve">
|
||||
<value>ShowProgressDialog('Creating security group ...');</value>
|
||||
<value>ShowProgressDialog('Creating group ...');</value>
|
||||
</data>
|
||||
<data name="btnCreate.Text" xml:space="preserve">
|
||||
<value>Create Security Group</value>
|
||||
<value>Create Group</value>
|
||||
</data>
|
||||
<data name="FormComments.Text" xml:space="preserve">
|
||||
<value />
|
||||
|
@ -136,7 +136,7 @@
|
|||
<value>Managed by: *</value>
|
||||
</data>
|
||||
<data name="locTitle.Text" xml:space="preserve">
|
||||
<value>Create New Security Group</value>
|
||||
<value>Create New Group</value>
|
||||
</data>
|
||||
<data name="Text.PageName" xml:space="preserve">
|
||||
<value>Security Groups</value>
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="btnSave.OnClientClick" xml:space="preserve">
|
||||
<value>ShowProgressDialog('Updating security group settings...');</value>
|
||||
<value>ShowProgressDialog('Updating group settings...');</value>
|
||||
</data>
|
||||
<data name="btnSave.Text" xml:space="preserve">
|
||||
<value>Save Changes</value>
|
||||
|
@ -139,10 +139,10 @@
|
|||
<value>Notes:</value>
|
||||
</data>
|
||||
<data name="locTitle.Text" xml:space="preserve">
|
||||
<value>Edit Security Group</value>
|
||||
<value>Edit Group</value>
|
||||
</data>
|
||||
<data name="Text.PageName" xml:space="preserve">
|
||||
<value>Security Group</value>
|
||||
<value>Security Groups</value>
|
||||
</data>
|
||||
<data name="valManager.ErrorMessage" xml:space="preserve">
|
||||
<value>Please specify a manager</value>
|
||||
|
|
|
@ -117,17 +117,17 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="btnCreateList.Text" xml:space="preserve">
|
||||
<value>Create New Security Group</value>
|
||||
<data name="btnCreateGroup.Text" xml:space="preserve">
|
||||
<value>Create New Group</value>
|
||||
</data>
|
||||
<data name="cmdDelete.OnClientClick" xml:space="preserve">
|
||||
<value>if(!confirm('Are you sure you want to delete this security group?')) return false; else ShowProgressDialog('Deleting security group...');</value>
|
||||
<value>if(!confirm('Are you sure you want to delete this group?')) return false; else ShowProgressDialog('Deleting group...');</value>
|
||||
</data>
|
||||
<data name="cmdDelete.Text" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="cmdDelete.ToolTip" xml:space="preserve">
|
||||
<value>Delete Security Group</value>
|
||||
<value>Delete Group</value>
|
||||
</data>
|
||||
<data name="cmdSearch.AlternateText" xml:space="preserve">
|
||||
<value>Search</value>
|
||||
|
@ -141,20 +141,14 @@
|
|||
<data name="FormComments.Text" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
<data name="gvLists.Empty" xml:space="preserve">
|
||||
<value>No security groups have been created. To create a new security group click "Create New Security Group" button.</value>
|
||||
<data name="gvGroups.Empty" xml:space="preserve">
|
||||
<value>No groups have been created. To create a new group click "Create New Group" button.</value>
|
||||
</data>
|
||||
<data name="gvListsDisplayName.Header" xml:space="preserve">
|
||||
<data name="gvGroupsDisplayName.Header" xml:space="preserve">
|
||||
<value>Display Name</value>
|
||||
</data>
|
||||
<data name="gvListsEmail.Header" xml:space="preserve">
|
||||
<value>E-mail Address</value>
|
||||
</data>
|
||||
<data name="locQuota.Text" xml:space="preserve">
|
||||
<value>Total Security Groups Created:</value>
|
||||
</data>
|
||||
<data name="locTitle.Text" xml:space="preserve">
|
||||
<value>Security Groups</value>
|
||||
<value>Groups</value>
|
||||
</data>
|
||||
<data name="Text.PageName" xml:space="preserve">
|
||||
<value>Security Groups</value>
|
||||
|
|
|
@ -21,33 +21,32 @@
|
|||
<div class="Center">
|
||||
<div class="Title">
|
||||
<asp:Image ID="Image1" SkinID="ExchangeListAdd48" runat="server" />
|
||||
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Create Distribution List"></asp:Localize>
|
||||
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Create Group"></asp:Localize>
|
||||
</div>
|
||||
<div class="FormBody">
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="FormLabel150"><asp:Localize ID="locDisplayName" runat="server" meta:resourcekey="locDisplayName" Text="Display Name: *"></asp:Localize></td>
|
||||
<td>
|
||||
<asp:TextBox ID="txtDisplayName" runat="server" CssClass="HugeTextBox200"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireDisplayName" runat="server" meta:resourcekey="valRequireDisplayName" ControlToValidate="txtDisplayName"
|
||||
ErrorMessage="Enter Display Name" ValidationGroup="CreateList" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
|
||||
ErrorMessage="Enter Display Name" ValidationGroup="CreateGroup" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="FormLabel150"><asp:Localize ID="Localize1" runat="server" meta:resourcekey="locManagedBy" ></asp:Localize></td>
|
||||
<td>
|
||||
<wsp:userselector id="manager" runat="server" />
|
||||
<wsp:userselector id="manager" IncludeMailboxes="true" runat="server" />
|
||||
<asp:CustomValidator runat="server"
|
||||
ValidationGroup="CreateList" meta:resourcekey="valManager" ID="valManager"
|
||||
ValidationGroup="CreateGroup" meta:resourcekey="valManager" ID="valManager"
|
||||
onservervalidate="valManager_ServerValidate" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="FormFooterClean">
|
||||
<asp:Button id="btnCreate" runat="server" Text="Create Distribution List" CssClass="Button1" meta:resourcekey="btnCreate" ValidationGroup="CreateList" OnClick="btnCreate_Click"></asp:Button>
|
||||
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="CreateList" />
|
||||
<asp:Button id="btnCreate" runat="server" Text="Create Group" CssClass="Button1" meta:resourcekey="btnCreate" ValidationGroup="CreateGroup" OnClick="btnCreate_Click"></asp:Button>
|
||||
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="CreateGroup" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void btnCreate_Click(object sender, EventArgs e)
|
||||
|
@ -54,43 +53,31 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
private void CreateSecurityGroup()
|
||||
{
|
||||
/*if (!Page.IsValid)
|
||||
return;*/
|
||||
|
||||
|
||||
|
||||
if (!Page.IsValid)
|
||||
return;
|
||||
try
|
||||
{
|
||||
int accountId = ES.Services.Organizations.CreateSecurityGroup(PanelRequest.ItemID, txtDisplayName.Text, manager.GetAccount());
|
||||
|
||||
//int accountId = ES.Services.ExchangeServer.CreateDistributionList(PanelRequest.ItemID,
|
||||
// txtDisplayName.Text.Trim(),
|
||||
// email.AccountName,
|
||||
// email.DomainName,
|
||||
// manager.GetAccountId());
|
||||
if (accountId < 0)
|
||||
{
|
||||
messageBox.ShowResultMessage(accountId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//if (accountId < 0)
|
||||
//{
|
||||
// messageBox.ShowResultMessage(accountId);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//Response.Redirect(EditUrl("AccountID", accountId.ToString(), "dlist_settings",
|
||||
// "SpaceID=" + PanelSecurity.PackageId.ToString(),
|
||||
// "ItemID=" + PanelRequest.ItemID.ToString()));
|
||||
Response.Redirect(EditUrl("AccountID", accountId.ToString(), "secur_group_settings",
|
||||
"SpaceID=" + PanelSecurity.PackageId.ToString(),
|
||||
"ItemID=" + PanelRequest.ItemID.ToString()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_CREATE_DISTRIBUTION_LIST", ex);
|
||||
messageBox.ShowErrorMessage("ORGANIZATION_CREATE_SECURITY_GROUP", ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected void valManager_ServerValidate(object source, ServerValidateEventArgs args)
|
||||
{
|
||||
args.IsValid = manager.GetAccountId() != 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -26,8 +26,8 @@
|
|||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
<div class="FormButtonsBarClean">
|
||||
<div class="FormButtonsBarCleanLeft">
|
||||
<asp:Button ID="btnCreateList" runat="server" meta:resourcekey="btnCreateList"
|
||||
Text="Create New Distribution List" CssClass="Button1" OnClick="btnCreateList_Click" />
|
||||
<asp:Button ID="btnCreateGroup" runat="server" meta:resourcekey="btnCreateGroup"
|
||||
Text="Create New Group" CssClass="Button1" OnClick="btnCreateGroup_Click" />
|
||||
</div>
|
||||
<div class="FormButtonsBarCleanRight">
|
||||
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
|
||||
|
@ -49,12 +49,12 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<asp:GridView ID="gvLists" runat="server" AutoGenerateColumns="False" EnableViewState="true"
|
||||
Width="100%" EmptyDataText="gvLists" CssSelectorClass="NormalGridView"
|
||||
<asp:GridView ID="gvGroups" runat="server" AutoGenerateColumns="False" EnableViewState="true"
|
||||
Width="100%" EmptyDataText="gvGroups" CssSelectorClass="NormalGridView"
|
||||
OnRowCommand="gvLists_RowCommand" AllowPaging="True" AllowSorting="True"
|
||||
DataSourceID="odsAccountsPaged" PageSize="20">
|
||||
DataSourceID="odsSecurityGroupsPaged" PageSize="20">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="gvListsDisplayName" SortExpression="DisplayName">
|
||||
<asp:TemplateField HeaderText="gvGroupsDisplayName" SortExpression="DisplayName">
|
||||
<ItemStyle Width="50%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:hyperlink id="lnk1" runat="server"
|
||||
|
@ -63,7 +63,6 @@
|
|||
</asp:hyperlink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="gvListsEmail" DataField="PrimaryEmailAddress" SortExpression="PrimaryEmailAddress" ItemStyle-Width="50%" />
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="cmdDelete" runat="server" Text="Delete" SkinID="ExchangeDelete"
|
||||
|
@ -73,12 +72,12 @@
|
|||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="odsAccountsPaged" runat="server" EnablePaging="True"
|
||||
SelectCountMethod="GetExchangeAccountsPagedCount"
|
||||
SelectMethod="GetExchangeAccountsPaged"
|
||||
<asp:ObjectDataSource ID="odsSecurityGroupsPaged" runat="server" EnablePaging="True"
|
||||
SelectCountMethod="GetOrganizationSecurityGroupsPagedCount"
|
||||
SelectMethod="GetOrganizationSecurityGroupsPaged"
|
||||
SortParameterName="sortColumn"
|
||||
TypeName="WebsitePanel.Portal.ExchangeHelper"
|
||||
OnSelected="odsAccountsPaged_Selected">
|
||||
TypeName="WebsitePanel.Portal.OrganizationsHelper"
|
||||
OnSelected="odsSecurityGroupsPaged_Selected">
|
||||
<SelectParameters>
|
||||
<asp:QueryStringParameter Name="itemId" QueryStringField="ItemID" DefaultValue="0" />
|
||||
<asp:Parameter Name="accountTypes" DefaultValue="3" />
|
||||
|
@ -86,12 +85,6 @@
|
|||
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<br />
|
||||
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Distribution Lists Created:"></asp:Localize>
|
||||
|
||||
<wsp:QuotaViewer ID="listsQuota" runat="server" QuotaTypeId="2" />
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -50,21 +50,13 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
{
|
||||
BindStats();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void BindStats()
|
||||
{
|
||||
// quota values
|
||||
OrganizationStatistics stats = ES.Services.ExchangeServer.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
|
||||
OrganizationStatistics tenantStats = ES.Services.ExchangeServer.GetOrganizationStatistics(PanelRequest.ItemID);
|
||||
listsQuota.QuotaUsedValue = stats.CreatedDistributionLists;
|
||||
listsQuota.QuotaValue = stats.AllocatedDistributionLists;
|
||||
if (stats.AllocatedDistributionLists != -1) listsQuota.QuotaAvailable = tenantStats.AllocatedDistributionLists - tenantStats.CreatedDistributionLists;
|
||||
}
|
||||
|
||||
protected void btnCreateList_Click(object sender, EventArgs e)
|
||||
protected void btnCreateGroup_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "create_secur_group",
|
||||
"SpaceID=" + PanelSecurity.PackageId.ToString()));
|
||||
|
@ -77,11 +69,11 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
"ItemID=" + PanelRequest.ItemID.ToString());
|
||||
}
|
||||
|
||||
protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
protected void odsSecurityGroupsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
if (e.Exception != null)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_GET_LISTS", e.Exception);
|
||||
messageBox.ShowErrorMessage("ORGANIZATION_GET_SECURITY_GROUP", e.Exception);
|
||||
e.ExceptionHandled = true;
|
||||
}
|
||||
}
|
||||
|
@ -90,12 +82,12 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
{
|
||||
if (e.CommandName == "DeleteItem")
|
||||
{
|
||||
// delete distribution list
|
||||
// delete security group
|
||||
int accountId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
|
||||
|
||||
try
|
||||
{
|
||||
int result = ES.Services.ExchangeServer.DeleteDistributionList(PanelRequest.ItemID, accountId);
|
||||
int result = ES.Services.Organizations.DeleteSecurityGroup(PanelRequest.ItemID, accountId);
|
||||
if (result < 0)
|
||||
{
|
||||
messageBox.ShowResultMessage(result);
|
||||
|
@ -103,28 +95,27 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
}
|
||||
|
||||
// rebind grid
|
||||
gvLists.DataBind();
|
||||
gvGroups.DataBind();
|
||||
|
||||
BindStats();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_DELETE_DISTRIBUTION_LIST", ex);
|
||||
messageBox.ShowErrorMessage("ORGANIZATION_DELETE_SECURITY_GROUP", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
gvLists.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
|
||||
{
|
||||
gvGroups.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
|
||||
|
||||
// rebind grid
|
||||
gvLists.DataBind();
|
||||
gvGroups.DataBind();
|
||||
|
||||
// bind stats
|
||||
BindStats();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -67,13 +67,13 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
/// <summary>
|
||||
/// btnCreateList control.
|
||||
/// btnCreateGroup 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.Button btnCreateList;
|
||||
protected global::System.Web.UI.WebControls.Button btnCreateGroup;
|
||||
|
||||
/// <summary>
|
||||
/// SearchPanel control.
|
||||
|
@ -130,39 +130,21 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
protected global::System.Web.UI.WebControls.ImageButton cmdSearch;
|
||||
|
||||
/// <summary>
|
||||
/// gvLists control.
|
||||
/// gvGroups 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.GridView gvLists;
|
||||
protected global::System.Web.UI.WebControls.GridView gvGroups;
|
||||
|
||||
/// <summary>
|
||||
/// odsAccountsPaged control.
|
||||
/// odsSecurityGroupsPaged 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.ObjectDataSource odsAccountsPaged;
|
||||
|
||||
/// <summary>
|
||||
/// locQuota 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 locQuota;
|
||||
|
||||
/// <summary>
|
||||
/// listsQuota control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.QuotaViewer listsQuota;
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource odsSecurityGroupsPaged;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue