diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.cs
index 24b053ee..6884ce2c 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.cs
@@ -67,6 +67,12 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
set { ViewState["DistributionListsEnabled"] = value; }
}
+ public bool SecurityGroupsEnabled
+ {
+ get { return ViewState["SecurityGroupsEnabled"] != null ? (bool)ViewState["SecurityGroupsEnabled"] : false; }
+ set { ViewState["SecurityGroupsEnabled"] = value; }
+ }
+
public int ExcludeAccountId
{
get { return PanelRequest.AccountID; }
@@ -109,6 +115,9 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
chkIncludeContacts.Checked = ContactsEnabled;
chkIncludeLists.Visible = DistributionListsEnabled;
chkIncludeLists.Checked = DistributionListsEnabled;
+
+ chkIncludeGroups.Visible = SecurityGroupsEnabled;
+ chkIncludeGroups.Checked = SecurityGroupsEnabled;
}
// register javascript
@@ -131,14 +140,16 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId;
string imgName = "mailbox_16.gif";
- if (accountType == ExchangeAccountType.Contact)
- imgName = "contact_16.gif";
- else if (accountType == ExchangeAccountType.DistributionList)
- imgName = "dlist_16.gif";
+ if (accountType == ExchangeAccountType.Contact)
+ imgName = "contact_16.gif";
+ else if (accountType == ExchangeAccountType.DistributionList)
+ imgName = "dlist_16.gif";
else if (accountType == ExchangeAccountType.Room)
imgName = "room_16.gif";
else if (accountType == ExchangeAccountType.Equipment)
imgName = "equipment_16.gif";
+ else if (accountType == ExchangeAccountType.Equipment)
+ imgName = "dlist_16.gif";
return GetThemedImage("Exchange/" + imgName);
}
@@ -174,7 +185,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
ExchangeAccount[] accounts = ES.Services.ExchangeServer.SearchAccounts(PanelRequest.ItemID,
chkIncludeMailboxes.Checked, chkIncludeContacts.Checked, chkIncludeLists.Checked,
- chkIncludeRooms.Checked, chkIncludeEquipment.Checked,
+ chkIncludeRooms.Checked, chkIncludeEquipment.Checked, chkIncludeGroups.Checked,
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
if (ExcludeAccountId > 0)
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.designer.cs
index 706f9ee3..e85c7542 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.designer.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx.designer.cs
@@ -1,22 +1,43 @@
+// Copyright (c) 2012, Outercurve Foundation.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// - Neither the name of the Outercurve Foundation nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:2.0.50727.832
//
// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer.UserControls {
- ///
- /// AccountsList class.
- ///
- ///
- /// Auto-generated class.
- ///
public partial class AccountsList {
///
@@ -136,6 +157,15 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls {
///
protected global::System.Web.UI.WebControls.CheckBox chkIncludeLists;
+ ///
+ /// chkIncludeGroups control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox chkIncludeGroups;
+
///
/// SearchPanel control.
///
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsListWithPermissions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsListWithPermissions.ascx.cs
index 3cc8f1a4..94351768 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsListWithPermissions.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsListWithPermissions.ascx.cs
@@ -184,7 +184,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
ExchangeAccount[] accounts = ES.Services.ExchangeServer.SearchAccounts(PanelRequest.ItemID,
chkIncludeMailboxes.Checked, chkIncludeContacts.Checked, chkIncludeLists.Checked,
- chkIncludeRooms.Checked, chkIncludeEquipment.Checked,
+ chkIncludeRooms.Checked, chkIncludeEquipment.Checked, false,
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
if (ExcludeAccountId > 0)
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/AccountsList.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/AccountsList.ascx.resx
index 624c5b9d..e8f53b78 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/AccountsList.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/AccountsList.ascx.resx
@@ -112,10 +112,10 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Add...
@@ -135,6 +135,9 @@
Equipment
+
+ Groups
+
Distribution Lists
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/GroupsList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/GroupsList.ascx.cs
index 85508aec..ffc23fdf 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/GroupsList.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/GroupsList.ascx.cs
@@ -116,8 +116,8 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
private void BindPopupAccounts()
{
- ExchangeAccount[] accounts = ES.Services.Organizations.SearchSecurityGroups(PanelRequest.ItemID,
- ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
+ ExchangeAccount[] accounts = ES.Services.Organizations.SearchOrganizationAccounts(PanelRequest.ItemID,
+ ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "", true);
accounts = accounts.Where(x => !GetAccounts().Contains(x.AccountName)).ToArray();
@@ -158,6 +158,8 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
gvGroups.DataSource = accounts;
gvGroups.DataBind();
+ UpdateGridViewAccounts(gvGroups);
+
btnDelete.Visible = gvGroups.Rows.Count > 0;
}
@@ -184,6 +186,39 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
return accounts;
}
+ private void UpdateGridViewAccounts(GridView gv)
+ {
+ CheckBox chkSelectAll = (CheckBox)gv.HeaderRow.FindControl("chkSelectAll");
+
+ for (int i = 0; i < gv.Rows.Count; i++)
+ {
+ GridViewRow row = gv.Rows[i];
+ CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect");
+ if (chkSelect == null)
+ {
+ continue;
+ }
+
+ ExchangeAccountType exAccountType = (ExchangeAccountType)Enum.Parse(typeof(ExchangeAccountType), ((Literal)row.FindControl("litAccountType")).Text);
+
+ if (exAccountType != ExchangeAccountType.DefaultSecurityGroup)
+ {
+ chkSelectAll = null;
+ chkSelect.Enabled = true;
+ }
+ else
+ {
+ chkSelect.Enabled = false;
+ }
+ }
+
+ if (chkSelectAll != null)
+ {
+ chkSelectAll.Enabled = false;
+ }
+
+ }
+
protected void chkIncludeMailboxes_CheckedChanged(object sender, EventArgs e)
{
BindPopupAccounts();
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxSelector.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxSelector.ascx.cs
index 62431785..561d897c 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxSelector.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxSelector.ascx.cs
@@ -157,7 +157,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
ExchangeAccount[] accounts = ES.Services.ExchangeServer.SearchAccounts(PanelRequest.ItemID,
chkIncludeMailboxes.Checked, chkIncludeContacts.Checked, chkIncludeLists.Checked,
- chkIncludeRooms.Checked, chkIncludeEquipment.Checked,
+ chkIncludeRooms.Checked, chkIncludeEquipment.Checked, false,
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
if (ExcludeAccountId > 0)
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx.cs
index b8311fd5..ec47b2e2 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx.cs
@@ -54,79 +54,12 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
Unselected
}
- public bool IncludeMailboxes
- {
- get
- {
- object ret = ViewState["IncludeMailboxes"];
- return (ret != null) ? (bool)ret : false;
- }
- set
- {
- ViewState["IncludeMailboxes"] = value;
- }
- }
-
- public bool IncludeMailboxesOnly
- {
- get
- {
- object ret = ViewState["IncludeMailboxesOnly"];
- return (ret != null) ? (bool)ret : false;
- }
- set
- {
- ViewState["IncludeMailboxesOnly"] = value;
- }
- }
-
-
- public bool ExcludeOCSUsers
- {
- get
- {
- object ret = ViewState["ExcludeOCSUsers"];
- return (ret != null) ? (bool)ret : false;
- }
- set
- {
- ViewState["ExcludeOCSUsers"] = value;
- }
- }
-
- public bool ExcludeLyncUsers
- {
- get
- {
- object ret = ViewState["ExcludeLyncUsers"];
- return (ret != null) ? (bool)ret : false;
- }
- set
- {
- ViewState["ExcludeLyncUsers"] = value;
- }
- }
-
-
- public bool ExcludeBESUsers
- {
- get
- {
- object ret = ViewState["ExcludeBESUsers"];
- return (ret != null) ? (bool)ret : false;
- }
- set
- {
- ViewState["ExcludeBESUsers"] = value;
- }
- }
-
public int ExcludeAccountId
{
get { return PanelRequest.AccountID; }
}
- public void SetAccounts(OrganizationUser[] accounts)
+ public void SetAccounts(ExchangeAccount[] accounts)
{
BindAccounts(accounts, false);
}
@@ -134,10 +67,10 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
public string[] GetAccounts()
{
// get selected accounts
- List selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All);
+ List selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All);
List accountNames = new List();
- foreach (OrganizationUser account in selectedAccounts)
+ foreach (ExchangeAccount account in selectedAccounts)
accountNames.Add(account.AccountName);
return accountNames.ToArray();
@@ -178,7 +111,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
protected void btnDelete_Click(object sender, EventArgs e)
{
// get selected accounts
- List selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.Unselected);
+ List selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.Unselected);
// add to the main list
BindAccounts(selectedAccounts.ToArray(), false);
@@ -187,7 +120,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
protected void btnAddSelected_Click(object sender, EventArgs e)
{
// get selected accounts
- List selectedAccounts = GetGridViewAccounts(gvPopupAccounts, SelectedState.Selected);
+ List selectedAccounts = GetGridViewAccounts(gvPopupAccounts, SelectedState.Selected);
// add to the main list
BindAccounts(selectedAccounts.ToArray(), true);
@@ -206,6 +139,9 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
case ExchangeAccountType.Equipment:
imgName = "equipment_16.gif";
break;
+ case ExchangeAccountType.SecurityGroup:
+ imgName = "dlist_16.gif";
+ break;
default:
imgName = "admin_16.png";
break;
@@ -216,58 +152,23 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
private void BindPopupAccounts()
{
- OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID,
- ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "", IncludeMailboxes);
+ ExchangeAccount[] accounts = ES.Services.Organizations.SearchOrganizationAccounts(PanelRequest.ItemID,
+ ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "", false);
- List newAccounts = new List();
+ List newAccounts = new List();
accounts = accounts.Where(x => !GetAccounts().Contains(x.AccountName)).ToArray();
if (ExcludeAccountId > 0)
{
- List updatedAccounts = new List();
- foreach (OrganizationUser account in accounts)
+ List updatedAccounts = new List();
+ foreach (ExchangeAccount account in accounts)
if (account.AccountId != ExcludeAccountId)
updatedAccounts.Add(account);
accounts = updatedAccounts.ToArray();
}
- if (IncludeMailboxesOnly)
- {
-
- List updatedAccounts = new List();
- foreach (OrganizationUser account in accounts)
- {
- bool addUser = false;
- if (account.ExternalEmail != string.Empty) addUser = true;
- if ((account.IsBlackBerryUser) & (ExcludeBESUsers)) addUser = false;
- if ((account.IsLyncUser) & (ExcludeLyncUsers)) addUser = false;
-
- if (addUser) updatedAccounts.Add(account);
- }
-
- accounts = updatedAccounts.ToArray();
- }
- else
- if ((ExcludeOCSUsers) | (ExcludeBESUsers) | (ExcludeLyncUsers))
- {
-
- List updatedAccounts = new List();
- foreach (OrganizationUser account in accounts)
- {
- bool addUser = true;
- if ((account.IsOCSUser) & (ExcludeOCSUsers)) addUser = false;
- if ((account.IsLyncUser) & (ExcludeLyncUsers)) addUser = false;
- if ((account.IsBlackBerryUser) & (ExcludeBESUsers)) addUser = false;
-
- if (addUser) updatedAccounts.Add(account);
- }
-
- accounts = updatedAccounts.ToArray();
- }
-
-
Array.Sort(accounts, CompareAccount);
if (Direction == SortDirection.Ascending)
{
@@ -281,21 +182,21 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
gvPopupAccounts.DataBind();
}
- private void BindAccounts(OrganizationUser[] newAccounts, bool preserveExisting)
+ private void BindAccounts(ExchangeAccount[] newAccounts, bool preserveExisting)
{
// get binded addresses
- List accounts = new List();
+ List accounts = new List();
if(preserveExisting)
accounts.AddRange(GetGridViewAccounts(gvAccounts, SelectedState.All));
// add new accounts
if (newAccounts != null)
{
- foreach (OrganizationUser newAccount in newAccounts)
+ foreach (ExchangeAccount newAccount in newAccounts)
{
// check if exists
bool exists = false;
- foreach (OrganizationUser account in accounts)
+ foreach (ExchangeAccount account in accounts)
{
if (String.Compare(newAccount.AccountName, account.AccountName, true) == 0)
{
@@ -317,9 +218,9 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
btnDelete.Visible = gvAccounts.Rows.Count > 0;
}
- private List GetGridViewAccounts(GridView gv, SelectedState state)
+ private List GetGridViewAccounts(GridView gv, SelectedState state)
{
- List accounts = new List();
+ List accounts = new List();
for (int i = 0; i < gv.Rows.Count; i++)
{
GridViewRow row = gv.Rows[i];
@@ -327,7 +228,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
if (chkSelect == null)
continue;
- OrganizationUser account = new OrganizationUser();
+ ExchangeAccount account = new ExchangeAccount();
account.AccountType = (ExchangeAccountType)Enum.Parse(typeof(ExchangeAccountType), ((Literal)row.FindControl("litAccountType")).Text);
account.AccountName = (string)gv.DataKeys[i][0];
account.DisplayName = ((Literal)row.FindControl("litDisplayName")).Text;
@@ -352,7 +253,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
set { ViewState[DirectionString] = value; }
}
- private static int CompareAccount(OrganizationUser user1, OrganizationUser user2)
+ private static int CompareAccount(ExchangeAccount user1, ExchangeAccount user2)
{
return string.Compare(user1.DisplayName, user2.DisplayName);
}