fixed bugs
This commit is contained in:
parent
80d4843693
commit
7be09843de
27 changed files with 513 additions and 274 deletions
|
@ -5326,4 +5326,19 @@
|
|||
<data name="WarningDescription.PHONE_EDIT_LIST_EMPTY_ERROR" xml:space="preserve">
|
||||
<value>At least one Phone number must be selected.</value>
|
||||
</data>
|
||||
<data name="Error.ORGANIZATION_CREATE_USER" xml:space="preserve">
|
||||
<value>Error creating user. See audit log for more details.</value>
|
||||
</data>
|
||||
<data name="Error.ORGANIZATION_CREATE_SECURITY_GROUP" xml:space="preserve">
|
||||
<value>Error creating security group. See audit log for more details.</value>
|
||||
</data>
|
||||
<data name="Error.ORGANIZATION_GET_SECURITY_GROUP_SETTINGS" xml:space="preserve">
|
||||
<value>Error reading organization security group settings</value>
|
||||
</data>
|
||||
<data name="Error.ORGANIZATION_UPDATE_SECURITY_GROUP_SETTINGS" xml:space="preserve">
|
||||
<value>Error updating organization security group settings</value>
|
||||
</data>
|
||||
<data name="Success.ORGANIZATION_UPDATE_SECURITY_GROUP_SETTINGS" xml:space="preserve">
|
||||
<value>Security group general settings have been successfully updated.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -30,12 +30,12 @@
|
|||
<wsp:DistributionListTabs id="tabs" runat="server" SelectedTab="dlist_memberof" />
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<wsp:CollapsiblePanel id="secDistributionLists" runat="server" TargetControlID="DistributionLists" meta:resourcekey="secDistributionLists" Text="Distribution Lists"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="DistributionLists" runat="server" Height="0" style="overflow:hidden;">
|
||||
<wsp:CollapsiblePanel id="secGroups" runat="server" TargetControlID="GroupsPanel" meta:resourcekey="secGroups" Text="Groups"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="GroupsPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
|
||||
<wsp:AccountsList id="distrlists" runat="server"
|
||||
<wsp:AccountsList id="groups" runat="server"
|
||||
MailboxesEnabled="false"
|
||||
EnableMailboxOnly="true"
|
||||
ContactsEnabled="false"
|
||||
|
|
|
@ -67,7 +67,20 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
ExchangeAccount[] dLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
distrlists.SetAccounts(dLists);
|
||||
ExchangeAccount[] secGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
List<ExchangeAccount> groupsList = new List<ExchangeAccount>();
|
||||
foreach (ExchangeAccount distList in dLists)
|
||||
{
|
||||
groupsList.Add(distList);
|
||||
}
|
||||
|
||||
foreach (ExchangeAccount secGroup in secGroups)
|
||||
{
|
||||
groupsList.Add(secGroup);
|
||||
}
|
||||
|
||||
groups.SetAccounts(groupsList.ToArray());
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -83,18 +96,53 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
try
|
||||
{
|
||||
ExchangeAccount[] oldDistributionLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
List<string> newDistributionLists = new List<string>(distrlists.GetAccounts());
|
||||
foreach (ExchangeAccount oldlist in oldDistributionLists)
|
||||
ExchangeAccount[] oldSecGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
ExchangeAccount[] oldDistLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
IList<ExchangeAccount> oldGroups = new List<ExchangeAccount>();
|
||||
foreach (ExchangeAccount distList in oldSecGroups)
|
||||
{
|
||||
if (newDistributionLists.Contains(oldlist.AccountName))
|
||||
newDistributionLists.Remove(oldlist.AccountName);
|
||||
else
|
||||
ES.Services.ExchangeServer.DeleteDistributionListMember(PanelRequest.ItemID, oldlist.AccountName, PanelRequest.AccountID);
|
||||
oldGroups.Add(distList);
|
||||
}
|
||||
|
||||
foreach (string newlist in newDistributionLists)
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newlist, PanelRequest.AccountID);
|
||||
foreach (ExchangeAccount secGroup in oldDistLists)
|
||||
{
|
||||
oldGroups.Add(secGroup);
|
||||
}
|
||||
|
||||
IDictionary<string, ExchangeAccountType> newGroups = groups.GetFullAccounts();
|
||||
foreach (ExchangeAccount oldGroup in oldGroups)
|
||||
{
|
||||
if (newGroups.ContainsKey(oldGroup.AccountName))
|
||||
{
|
||||
newGroups.Remove(oldGroup.AccountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (oldGroup.AccountType)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
ES.Services.ExchangeServer.DeleteDistributionListMember(PanelRequest.ItemID, oldGroup.AccountName, PanelRequest.AccountID);
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
ES.Services.Organizations.DeleteObjectFromSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, oldGroup.AccountName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, ExchangeAccountType> newGroup in newGroups)
|
||||
{
|
||||
switch (newGroup.Value)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newGroup.Key, PanelRequest.AccountID);
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
ES.Services.Organizations.AddObjectToSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, newGroup.Key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_UPDATE_DLIST_SETTINGS");
|
||||
BindSettings();
|
||||
|
|
|
@ -85,22 +85,22 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
/// <summary>
|
||||
/// secDistributionLists control.
|
||||
/// secGroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists;
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secGroups;
|
||||
|
||||
/// <summary>
|
||||
/// DistributionLists control.
|
||||
/// GroupsPanel 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 DistributionLists;
|
||||
protected global::System.Web.UI.WebControls.Panel GroupsPanel;
|
||||
|
||||
/// <summary>
|
||||
/// GeneralUpdatePanel control.
|
||||
|
@ -112,13 +112,13 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel;
|
||||
|
||||
/// <summary>
|
||||
/// distrlists control.
|
||||
/// groups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists;
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList groups;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
<wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_memberof" />
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<wsp:CollapsiblePanel id="secDistributionLists" runat="server" TargetControlID="DistributionLists" meta:resourcekey="secDistributionLists" Text="Distribution Lists"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="DistributionLists" runat="server" Height="0" style="overflow:hidden;">
|
||||
<wsp:CollapsiblePanel id="secGroups" runat="server" TargetControlID="GroupsPanel" meta:resourcekey="secGroups" Text="Groups"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="GroupsPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
|
||||
<wsp:AccountsList id="distrlists" runat="server"
|
||||
<wsp:AccountsList id="groups" runat="server"
|
||||
MailboxesEnabled="false"
|
||||
EnableMailboxOnly="true"
|
||||
ContactsEnabled="false"
|
||||
|
|
|
@ -59,10 +59,24 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
// title
|
||||
litDisplayName.Text = mailbox.DisplayName;
|
||||
|
||||
//Distribution Lists
|
||||
ExchangeAccount[] dLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
distrlists.SetAccounts(dLists);
|
||||
//Security Groups
|
||||
ExchangeAccount[] securGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
List<ExchangeAccount> groupsList = new List<ExchangeAccount>();
|
||||
foreach (ExchangeAccount distList in dLists)
|
||||
{
|
||||
groupsList.Add(distList);
|
||||
}
|
||||
|
||||
foreach (ExchangeAccount secGroup in securGroups)
|
||||
{
|
||||
groupsList.Add(secGroup);
|
||||
}
|
||||
|
||||
groups.SetAccounts(groupsList.ToArray());
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -78,18 +92,53 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
try
|
||||
{
|
||||
ExchangeAccount[] oldDistributionLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
List<string> newDistributionLists = new List<string>(distrlists.GetAccounts());
|
||||
foreach (ExchangeAccount oldlist in oldDistributionLists)
|
||||
ExchangeAccount[] oldSecGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
ExchangeAccount[] oldDistLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
IList<ExchangeAccount> oldGroups = new List<ExchangeAccount>();
|
||||
foreach (ExchangeAccount distList in oldSecGroups)
|
||||
{
|
||||
if (newDistributionLists.Contains(oldlist.AccountName))
|
||||
newDistributionLists.Remove(oldlist.AccountName);
|
||||
else
|
||||
ES.Services.ExchangeServer.DeleteDistributionListMember(PanelRequest.ItemID, oldlist.AccountName, PanelRequest.AccountID);
|
||||
oldGroups.Add(distList);
|
||||
}
|
||||
|
||||
foreach (string newlist in newDistributionLists)
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newlist, PanelRequest.AccountID);
|
||||
foreach (ExchangeAccount secGroup in oldDistLists)
|
||||
{
|
||||
oldGroups.Add(secGroup);
|
||||
}
|
||||
|
||||
IDictionary<string, ExchangeAccountType> newGroups = groups.GetFullAccounts();
|
||||
foreach (ExchangeAccount oldGroup in oldGroups)
|
||||
{
|
||||
if (newGroups.ContainsKey(oldGroup.AccountName))
|
||||
{
|
||||
newGroups.Remove(oldGroup.AccountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (oldGroup.AccountType)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
ES.Services.ExchangeServer.DeleteDistributionListMember(PanelRequest.ItemID, oldGroup.AccountName, PanelRequest.AccountID);
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
ES.Services.Organizations.DeleteObjectFromSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, oldGroup.AccountName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, ExchangeAccountType> newGroup in newGroups)
|
||||
{
|
||||
switch (newGroup.Value)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newGroup.Key, PanelRequest.AccountID);
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
ES.Services.Organizations.AddObjectToSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, newGroup.Key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_UPDATE_MAILBOX_SETTINGS");
|
||||
BindSettings();
|
||||
|
@ -104,7 +153,5 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -85,22 +85,22 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
/// <summary>
|
||||
/// secDistributionLists control.
|
||||
/// secGroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists;
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secGroups;
|
||||
|
||||
/// <summary>
|
||||
/// DistributionLists control.
|
||||
/// GroupsPanel 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 DistributionLists;
|
||||
protected global::System.Web.UI.WebControls.Panel GroupsPanel;
|
||||
|
||||
/// <summary>
|
||||
/// GeneralUpdatePanel control.
|
||||
|
@ -112,13 +112,13 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel;
|
||||
|
||||
/// <summary>
|
||||
/// distrlists control.
|
||||
/// groups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists;
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList groups;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_CREATE_MAILBOX", ex);
|
||||
messageBox.ShowErrorMessage("ORGANIZATION_CREATE_USER", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,27 +43,17 @@
|
|||
<uc1:MailboxTabs ID="MailboxTabsId" runat="server" SelectedTab="user_memberof" />
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<wsp:CollapsiblePanel id="secDistributionLists" runat="server" TargetControlID="DistributionListsPanel" meta:resourcekey="secDistributionLists" Text="Distribution Lists"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="DistributionListsPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||
<asp:UpdatePanel ID="DLGeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<wsp:CollapsiblePanel id="secGroups" runat="server" TargetControlID="GroupsPanel" meta:resourcekey="secGroups" Text="Groups"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="GroupsPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
|
||||
<wsp:AccountsList id="distrlists" runat="server"
|
||||
<wsp:AccountsList id="groups" runat="server"
|
||||
MailboxesEnabled="false"
|
||||
EnableMailboxOnly="true"
|
||||
ContactsEnabled="false"
|
||||
DistributionListsEnabled="true" />
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Panel>
|
||||
|
||||
<wsp:CollapsiblePanel id="secSecurityGroups" runat="server" TargetControlID="SecurityGroupsPanel" meta:resourcekey="secSecurityGroups" Text="Groups"></wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="SecurityGroupsPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||
<asp:UpdatePanel ID="SCGeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
|
||||
<wsp:GroupsList id="securegroups" runat="server" />
|
||||
DistributionListsEnabled="true"
|
||||
SecurityGroupsEnabled="true" />
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
BindSettings();
|
||||
|
||||
MailboxTabsId.Visible = (PanelRequest.Context == "Mailbox");
|
||||
|
||||
UserTabsId.Visible = (PanelRequest.Context == "User");
|
||||
}
|
||||
}
|
||||
|
@ -53,26 +54,37 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
try
|
||||
{
|
||||
// get settings
|
||||
ExchangeMailbox mailbox = ES.Services.ExchangeServer.GetMailboxGeneralSettings(PanelRequest.ItemID,
|
||||
PanelRequest.AccountID);
|
||||
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
// title
|
||||
litDisplayName.Text = mailbox.DisplayName;
|
||||
|
||||
groups.DistributionListsEnabled = (user.AccountType == ExchangeAccountType.Mailbox
|
||||
|| user.AccountType == ExchangeAccountType.Room
|
||||
|| user.AccountType == ExchangeAccountType.Equipment);
|
||||
|
||||
litDisplayName.Text = user.DisplayName;
|
||||
|
||||
//Distribution Lists
|
||||
ExchangeAccount[] dLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
distrlists.SetAccounts(dLists);
|
||||
|
||||
//Security Groups
|
||||
ExchangeAccount[] securGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
securegroups.SetAccounts(securGroups);
|
||||
List<ExchangeAccount> groupsList = new List<ExchangeAccount>();
|
||||
foreach (ExchangeAccount distList in dLists)
|
||||
{
|
||||
groupsList.Add(distList);
|
||||
}
|
||||
|
||||
foreach (ExchangeAccount secGroup in securGroups)
|
||||
{
|
||||
groupsList.Add(secGroup);
|
||||
}
|
||||
|
||||
groups.SetAccounts(groupsList.ToArray());
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_GET_MAILBOX_SETTINGS", ex);
|
||||
messageBox.ShowErrorMessage("ORGANIZATION_GET_USER_SETTINGS", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,48 +95,62 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
|
||||
try
|
||||
{
|
||||
//Distribution Lists
|
||||
ExchangeAccount[] oldDistributionLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
List<string> newDistributionLists = new List<string>(distrlists.GetAccounts());
|
||||
foreach (ExchangeAccount oldlist in oldDistributionLists)
|
||||
ExchangeAccount[] oldSecGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
ExchangeAccount[] oldDistLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
IList<ExchangeAccount> oldGroups = new List<ExchangeAccount>();
|
||||
foreach (ExchangeAccount distList in oldSecGroups)
|
||||
{
|
||||
if (newDistributionLists.Contains(oldlist.AccountName))
|
||||
newDistributionLists.Remove(oldlist.AccountName);
|
||||
else
|
||||
ES.Services.ExchangeServer.DeleteDistributionListMember(PanelRequest.ItemID, oldlist.AccountName, PanelRequest.AccountID);
|
||||
oldGroups.Add(distList);
|
||||
}
|
||||
|
||||
foreach (string newlist in newDistributionLists)
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newlist, PanelRequest.AccountID);
|
||||
|
||||
//Security Groups
|
||||
ExchangeAccount[] oldDSecurityGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
List<string> newSecurityGroups = new List<string>(securegroups.GetAccounts());
|
||||
foreach (ExchangeAccount oldgroup in oldDSecurityGroups)
|
||||
foreach (ExchangeAccount secGroup in oldDistLists)
|
||||
{
|
||||
if (newSecurityGroups.Contains(oldgroup.AccountName))
|
||||
oldGroups.Add(secGroup);
|
||||
}
|
||||
|
||||
IDictionary<string, ExchangeAccountType> newGroups = groups.GetFullAccounts();
|
||||
foreach (ExchangeAccount oldGroup in oldGroups)
|
||||
{
|
||||
if (newGroups.ContainsKey(oldGroup.AccountName))
|
||||
{
|
||||
newSecurityGroups.Remove(oldgroup.AccountName);
|
||||
newGroups.Remove(oldGroup.AccountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
ES.Services.Organizations.DeleteUserFromSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, oldgroup.AccountName);
|
||||
switch (oldGroup.AccountType)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
ES.Services.ExchangeServer.DeleteDistributionListMember(PanelRequest.ItemID, oldGroup.AccountName, PanelRequest.AccountID);
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
ES.Services.Organizations.DeleteObjectFromSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, oldGroup.AccountName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string newgroup in newSecurityGroups)
|
||||
foreach (KeyValuePair<string, ExchangeAccountType> newGroup in newGroups)
|
||||
{
|
||||
ES.Services.Organizations.AddUserToSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, newgroup);
|
||||
switch (newGroup.Value)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newGroup.Key, PanelRequest.AccountID);
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
ES.Services.Organizations.AddObjectToSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, newGroup.Key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_UPDATE_MAILBOX_SETTINGS");
|
||||
messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_USER_SETTINGS");
|
||||
|
||||
|
||||
BindSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_UPDATE_MAILBOX_SETTINGS", ex);
|
||||
messageBox.ShowErrorMessage("ORGANIZATION_UPDATE_USER_SETTINGS", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,76 +94,40 @@ namespace WebsitePanel.Portal.HostedSolution {
|
|||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
/// <summary>
|
||||
/// secDistributionLists control.
|
||||
/// secGroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists;
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secGroups;
|
||||
|
||||
/// <summary>
|
||||
/// DistributionListsPanel control.
|
||||
/// GroupsPanel 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 DistributionListsPanel;
|
||||
protected global::System.Web.UI.WebControls.Panel GroupsPanel;
|
||||
|
||||
/// <summary>
|
||||
/// DLGeneralUpdatePanel control.
|
||||
/// GeneralUpdatePanel 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 DLGeneralUpdatePanel;
|
||||
protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel;
|
||||
|
||||
/// <summary>
|
||||
/// distrlists control.
|
||||
/// groups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists;
|
||||
|
||||
/// <summary>
|
||||
/// secSecurityGroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secSecurityGroups;
|
||||
|
||||
/// <summary>
|
||||
/// SecurityGroupsPanel 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 SecurityGroupsPanel;
|
||||
|
||||
/// <summary>
|
||||
/// SCGeneralUpdatePanel 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 SCGeneralUpdatePanel;
|
||||
|
||||
/// <summary>
|
||||
/// securegroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.GroupsList securegroups;
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList groups;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsAccountType" HeaderText="gvAccountsAccountType">
|
||||
<HeaderStyle Wrap="false" />
|
||||
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="litType" runat="server" Text='<%# GetType((int)Eval("AccountType")) %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
|
@ -111,6 +118,12 @@
|
|||
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsAccountType" HeaderText="gvAccountsAccountType">
|
||||
<ItemStyle Width="50%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="litType" runat="server" Text='<%# GetType((int)Eval("AccountType")) %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
@ -83,16 +84,31 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
BindAccounts(accounts, false);
|
||||
}
|
||||
|
||||
public string[] GetAccounts()
|
||||
public string[] GetAccounts()
|
||||
{
|
||||
// get selected accounts
|
||||
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All);
|
||||
|
||||
List<string> accountNames = new List<string>();
|
||||
foreach (ExchangeAccount account in selectedAccounts)
|
||||
accountNames.Add(account.AccountName);
|
||||
|
||||
return accountNames.ToArray();
|
||||
}
|
||||
|
||||
public IDictionary<string, ExchangeAccountType> GetFullAccounts()
|
||||
{
|
||||
// get selected accounts
|
||||
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All);
|
||||
|
||||
List<string> accountNames = new List<string>();
|
||||
foreach (ExchangeAccount account in selectedAccounts)
|
||||
accountNames.Add(account.AccountName);
|
||||
IDictionary<string, ExchangeAccountType> accounts = new Dictionary<string, ExchangeAccountType>();
|
||||
|
||||
return accountNames.ToArray();
|
||||
foreach (ExchangeAccount account in selectedAccounts)
|
||||
{
|
||||
accounts.Add(account.AccountName, account.AccountType);
|
||||
}
|
||||
|
||||
return accounts;
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
|
@ -118,6 +134,8 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
|
||||
chkIncludeGroups.Visible = SecurityGroupsEnabled;
|
||||
chkIncludeGroups.Checked = SecurityGroupsEnabled;
|
||||
|
||||
gvAccounts.Columns[3].Visible = gvPopupAccounts.Columns[3].Visible = SecurityGroupsEnabled;
|
||||
}
|
||||
|
||||
// register javascript
|
||||
|
@ -142,18 +160,35 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
string imgName = "mailbox_16.gif";
|
||||
if (accountType == ExchangeAccountType.Contact)
|
||||
imgName = "contact_16.gif";
|
||||
else if (accountType == ExchangeAccountType.DistributionList)
|
||||
else if (accountType == ExchangeAccountType.DistributionList
|
||||
|| accountType == ExchangeAccountType.SecurityGroup
|
||||
|| accountType == ExchangeAccountType.DefaultSecurityGroup)
|
||||
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);
|
||||
}
|
||||
|
||||
public string GetType(int accountTypeId)
|
||||
{
|
||||
ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId;
|
||||
|
||||
switch(accountType)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
return "Distribution";
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
return "Security";
|
||||
case ExchangeAccountType.DefaultSecurityGroup:
|
||||
return "Default";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
// bind all accounts
|
||||
|
@ -188,6 +223,11 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
chkIncludeRooms.Checked, chkIncludeEquipment.Checked, chkIncludeGroups.Checked,
|
||||
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
|
||||
|
||||
if (SecurityGroupsEnabled)
|
||||
{
|
||||
accounts = accounts.Where(x => !GetAccounts().Contains(x.AccountName)).ToArray();
|
||||
}
|
||||
|
||||
if (ExcludeAccountId > 0)
|
||||
{
|
||||
List<ExchangeAccount> updatedAccounts = new List<ExchangeAccount>();
|
||||
|
@ -200,6 +240,11 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
|
||||
gvPopupAccounts.DataSource = accounts;
|
||||
gvPopupAccounts.DataBind();
|
||||
|
||||
if (gvPopupAccounts.Rows.Count > 0)
|
||||
{
|
||||
UpdateGridViewAccounts(gvPopupAccounts);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindAccounts(ExchangeAccount[] newAccounts, bool preserveExisting)
|
||||
|
@ -235,6 +280,11 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
gvAccounts.DataSource = accounts;
|
||||
gvAccounts.DataBind();
|
||||
|
||||
if (gvAccounts.Rows.Count > 0)
|
||||
{
|
||||
UpdateGridViewAccounts(gvAccounts);
|
||||
}
|
||||
|
||||
btnDelete.Visible = gvAccounts.Rows.Count > 0;
|
||||
}
|
||||
|
||||
|
@ -262,6 +312,38 @@ 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();
|
||||
|
|
|
@ -156,6 +156,9 @@
|
|||
<data name="gvAccounts.EmptyDataText" xml:space="preserve">
|
||||
<value>The list of accounts is empty. Click "Add..." button to add accounts.</value>
|
||||
</data>
|
||||
<data name="gvAccountsAccountType.HeaderText" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="gvAccountsDisplayName.HeaderText" xml:space="preserve">
|
||||
<value>Display Name</value>
|
||||
</data>
|
||||
|
|
|
@ -153,6 +153,9 @@
|
|||
<data name="gvAccounts.EmptyDataText" xml:space="preserve">
|
||||
<value>The list of accounts is empty. Click "Add..." button to add accounts.</value>
|
||||
</data>
|
||||
<data name="gvAccountsAccountType.HeaderText" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="gvAccountsDisplayName.HeaderText" xml:space="preserve">
|
||||
<value>Display Name</value>
|
||||
</data>
|
||||
|
@ -163,7 +166,7 @@
|
|||
<value>No accounts found.</value>
|
||||
</data>
|
||||
<data name="headerAddAccounts.Text" xml:space="preserve">
|
||||
<value>Organization Users</value>
|
||||
<value>Organization Accounts</value>
|
||||
</data>
|
||||
<data name="locIncludeSearch.Text" xml:space="preserve">
|
||||
<value>Include in search:</value>
|
||||
|
|
|
@ -216,7 +216,6 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
{
|
||||
chkSelectAll.Enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void chkIncludeMailboxes_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsDisplayName" HeaderText="gvAccountsDisplayName">
|
||||
<HeaderStyle Wrap="false" />
|
||||
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
|
||||
<ItemStyle Width="34%" Wrap="false"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
|
||||
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
|
||||
|
@ -31,11 +31,18 @@
|
|||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsEmail" HeaderText="gvAccountsEmail">
|
||||
<HeaderStyle Wrap="false" />
|
||||
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
|
||||
<ItemStyle Width="33%" Wrap="false"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsAccountType" HeaderText="gvAccountsAccountType">
|
||||
<HeaderStyle Wrap="false" />
|
||||
<ItemStyle Width="33%" Wrap="false"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="litType" runat="server" Text='<%# GetType((int)Eval("AccountType")) %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
|
@ -83,18 +90,24 @@
|
|||
<ItemStyle Width="10px" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsDisplayName">
|
||||
<ItemStyle Width="50%"></ItemStyle>
|
||||
<ItemStyle Width="34%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
|
||||
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsEmail">
|
||||
<ItemStyle Width="50%"></ItemStyle>
|
||||
<ItemStyle Width="33%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvAccountsAccountType" HeaderText="gvAccountsAccountType">
|
||||
<ItemStyle Width="33%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="litType" runat="server" Text='<%# GetType((int)Eval("AccountType")) %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
|
|
@ -139,9 +139,15 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
case ExchangeAccountType.Equipment:
|
||||
imgName = "equipment_16.gif";
|
||||
break;
|
||||
case ExchangeAccountType.DistributionList:
|
||||
imgName = "dlist_16.gif";
|
||||
break;
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
imgName = "dlist_16.gif";
|
||||
break;
|
||||
case ExchangeAccountType.DefaultSecurityGroup:
|
||||
imgName = "dlist_16.gif";
|
||||
break;
|
||||
default:
|
||||
imgName = "admin_16.png";
|
||||
break;
|
||||
|
@ -150,6 +156,23 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
return GetThemedImage("Exchange/" + imgName);
|
||||
}
|
||||
|
||||
public string GetType(int accountTypeId)
|
||||
{
|
||||
ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId;
|
||||
|
||||
switch (accountType)
|
||||
{
|
||||
case ExchangeAccountType.DistributionList:
|
||||
return "Distribution";
|
||||
case ExchangeAccountType.SecurityGroup:
|
||||
return "Security";
|
||||
case ExchangeAccountType.DefaultSecurityGroup:
|
||||
return "Default Group";
|
||||
default:
|
||||
return accountType.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void BindPopupAccounts()
|
||||
{
|
||||
ExchangeAccount[] accounts = ES.Services.Organizations.SearchOrganizationAccounts(PanelRequest.ItemID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue