diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs index fe3e9e11..5bf2a416 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs @@ -127,9 +127,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution private System.Threading.SendOrPostCallback GetOrganizationSecurityGroupsPagedOperationCompleted; - private System.Threading.SendOrPostCallback AddUserToSecurityGroupOperationCompleted; + private System.Threading.SendOrPostCallback AddObjectToSecurityGroupOperationCompleted; - private System.Threading.SendOrPostCallback DeleteUserFromSecurityGroupOperationCompleted; + private System.Threading.SendOrPostCallback DeleteObjectFromSecurityGroupOperationCompleted; private System.Threading.SendOrPostCallback GetSecurityGroupsByMemberOperationCompleted; @@ -235,10 +235,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution public event GetOrganizationSecurityGroupsPagedCompletedEventHandler GetOrganizationSecurityGroupsPagedCompleted; /// - public event AddUserToSecurityGroupCompletedEventHandler AddUserToSecurityGroupCompleted; + public event AddObjectToSecurityGroupCompletedEventHandler AddObjectToSecurityGroupCompleted; /// - public event DeleteUserFromSecurityGroupCompletedEventHandler DeleteUserFromSecurityGroupCompleted; + public event DeleteObjectFromSecurityGroupCompletedEventHandler DeleteObjectFromSecurityGroupCompleted; /// public event GetSecurityGroupsByMemberCompletedEventHandler GetSecurityGroupsByMemberCompleted; @@ -2166,112 +2166,112 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddUserToSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int AddUserToSecurityGroup(int itemId, int userAccountId, string groupName) + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddObjectToSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int AddObjectToSecurityGroup(int itemId, int accountId, string groupName) { - object[] results = this.Invoke("AddUserToSecurityGroup", new object[] { + object[] results = this.Invoke("AddObjectToSecurityGroup", new object[] { itemId, - userAccountId, + accountId, groupName}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginAddUserToSecurityGroup(int itemId, int userAccountId, string groupName, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginAddObjectToSecurityGroup(int itemId, int accountId, string groupName, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("AddUserToSecurityGroup", new object[] { + return this.BeginInvoke("AddObjectToSecurityGroup", new object[] { itemId, - userAccountId, + accountId, groupName}, callback, asyncState); } /// - public int EndAddUserToSecurityGroup(System.IAsyncResult asyncResult) + public int EndAddObjectToSecurityGroup(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((int)(results[0])); } /// - public void AddUserToSecurityGroupAsync(int itemId, int userAccountId, string groupName) + public void AddObjectToSecurityGroupAsync(int itemId, int accountId, string groupName) { - this.AddUserToSecurityGroupAsync(itemId, userAccountId, groupName, null); + this.AddObjectToSecurityGroupAsync(itemId, accountId, groupName, null); } /// - public void AddUserToSecurityGroupAsync(int itemId, int userAccountId, string groupName, object userState) + public void AddObjectToSecurityGroupAsync(int itemId, int accountId, string groupName, object userState) { - if ((this.AddUserToSecurityGroupOperationCompleted == null)) + if ((this.AddObjectToSecurityGroupOperationCompleted == null)) { - this.AddUserToSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddUserToSecurityGroupOperationCompleted); + this.AddObjectToSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddObjectToSecurityGroupOperationCompleted); } - this.InvokeAsync("AddUserToSecurityGroup", new object[] { + this.InvokeAsync("AddObjectToSecurityGroup", new object[] { itemId, - userAccountId, - groupName}, this.AddUserToSecurityGroupOperationCompleted, userState); + accountId, + groupName}, this.AddObjectToSecurityGroupOperationCompleted, userState); } - private void OnAddUserToSecurityGroupOperationCompleted(object arg) + private void OnAddObjectToSecurityGroupOperationCompleted(object arg) { - if ((this.AddUserToSecurityGroupCompleted != null)) + if ((this.AddObjectToSecurityGroupCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.AddUserToSecurityGroupCompleted(this, new AddUserToSecurityGroupCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + this.AddObjectToSecurityGroupCompleted(this, new AddObjectToSecurityGroupCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteUserFromSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int DeleteUserFromSecurityGroup(int itemId, int userAccountId, string groupName) + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteObjectFromSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int DeleteObjectFromSecurityGroup(int itemId, int accountId, string groupName) { - object[] results = this.Invoke("DeleteUserFromSecurityGroup", new object[] { + object[] results = this.Invoke("DeleteObjectFromSecurityGroup", new object[] { itemId, - userAccountId, + accountId, groupName}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginDeleteUserFromSecurityGroup(int itemId, int userAccountId, string groupName, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginDeleteObjectFromSecurityGroup(int itemId, int accountId, string groupName, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("DeleteUserFromSecurityGroup", new object[] { + return this.BeginInvoke("DeleteObjectFromSecurityGroup", new object[] { itemId, - userAccountId, + accountId, groupName}, callback, asyncState); } /// - public int EndDeleteUserFromSecurityGroup(System.IAsyncResult asyncResult) + public int EndDeleteObjectFromSecurityGroup(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((int)(results[0])); } /// - public void DeleteUserFromSecurityGroupAsync(int itemId, int userAccountId, string groupName) + public void DeleteObjectFromSecurityGroupAsync(int itemId, int accountId, string groupName) { - this.DeleteUserFromSecurityGroupAsync(itemId, userAccountId, groupName, null); + this.DeleteObjectFromSecurityGroupAsync(itemId, accountId, groupName, null); } /// - public void DeleteUserFromSecurityGroupAsync(int itemId, int userAccountId, string groupName, object userState) + public void DeleteObjectFromSecurityGroupAsync(int itemId, int accountId, string groupName, object userState) { - if ((this.DeleteUserFromSecurityGroupOperationCompleted == null)) + if ((this.DeleteObjectFromSecurityGroupOperationCompleted == null)) { - this.DeleteUserFromSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteUserFromSecurityGroupOperationCompleted); + this.DeleteObjectFromSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteObjectFromSecurityGroupOperationCompleted); } - this.InvokeAsync("DeleteUserFromSecurityGroup", new object[] { + this.InvokeAsync("DeleteObjectFromSecurityGroup", new object[] { itemId, - userAccountId, - groupName}, this.DeleteUserFromSecurityGroupOperationCompleted, userState); + accountId, + groupName}, this.DeleteObjectFromSecurityGroupOperationCompleted, userState); } - private void OnDeleteUserFromSecurityGroupOperationCompleted(object arg) + private void OnDeleteObjectFromSecurityGroupOperationCompleted(object arg) { - if ((this.DeleteUserFromSecurityGroupCompleted != null)) + if ((this.DeleteObjectFromSecurityGroupCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.DeleteUserFromSecurityGroupCompleted(this, new DeleteUserFromSecurityGroupCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + this.DeleteObjectFromSecurityGroupCompleted(this, new DeleteObjectFromSecurityGroupCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } @@ -3327,18 +3327,18 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - public delegate void AddUserToSecurityGroupCompletedEventHandler(object sender, AddUserToSecurityGroupCompletedEventArgs e); + public delegate void AddObjectToSecurityGroupCompletedEventHandler(object sender, AddObjectToSecurityGroupCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class AddUserToSecurityGroupCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + public partial class AddObjectToSecurityGroupCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; - internal AddUserToSecurityGroupCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + internal AddObjectToSecurityGroupCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; @@ -3357,18 +3357,18 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - public delegate void DeleteUserFromSecurityGroupCompletedEventHandler(object sender, DeleteUserFromSecurityGroupCompletedEventArgs e); + public delegate void DeleteObjectFromSecurityGroupCompletedEventHandler(object sender, DeleteObjectFromSecurityGroupCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class DeleteUserFromSecurityGroupCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + public partial class DeleteObjectFromSecurityGroupCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; - internal DeleteUserFromSecurityGroupCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + internal DeleteObjectFromSecurityGroupCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 47d067fb..dc6de57b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -3407,7 +3407,7 @@ namespace WebsitePanel.EnterpriseServer ExchangeDistributionList dl = exchange.GetDistributionListGeneralSettings(accountName); // add meta-item - int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, email, + int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, accountName, displayName, email, false, 0, dl.SAMAccountName, null, 0, null); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index d2fb54ce..7a8f6762 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -2514,7 +2514,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - public static int AddUserToSecurityGroup(int itemId, int userAccountId, string groupName) + public static int AddObjectToSecurityGroup(int itemId, int accountId, string groupName) { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); @@ -2531,11 +2531,11 @@ namespace WebsitePanel.EnterpriseServer return -1; // load user account - OrganizationUser userAccount = GetAccount(itemId, userAccountId); + ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId); Organizations orgProxy = GetOrganizationProxy(org.ServiceId); - orgProxy.AddUserToSecurityGroup(org.OrganizationId, userAccount.AccountName, groupName); + orgProxy.AddObjectToSecurityGroup(org.OrganizationId, account.AccountName, groupName); return 0; } @@ -2549,7 +2549,7 @@ namespace WebsitePanel.EnterpriseServer } } - public static int DeleteUserFromSecurityGroup(int itemId, int userAccountId, string groupName) + public static int DeleteObjectFromSecurityGroup(int itemId, int accountId, string groupName) { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); @@ -2566,11 +2566,11 @@ namespace WebsitePanel.EnterpriseServer return -1; // load user account - OrganizationUser userAccount = GetAccount(itemId, userAccountId); + ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId); Organizations orgProxy = GetOrganizationProxy(org.ServiceId); - orgProxy.DeleteUserFromSecurityGroup(org.OrganizationId, userAccount.AccountName, groupName); + orgProxy.DeleteObjectFromSecurityGroup(org.OrganizationId, account.AccountName, groupName); return 0; } @@ -2699,8 +2699,8 @@ namespace WebsitePanel.EnterpriseServer if (!includeOnlySecurityGroups) { - accountTypes = string.Format("{0}, {1}, {2}, {3}, {4}", accountTypes, ((int)ExchangeAccountType.User), ((int)ExchangeAccountType.Mailbox), - ((int)ExchangeAccountType.Room), ((int)ExchangeAccountType.Equipment)); + accountTypes = string.Format("{0}, {1}, {2}, {3}, {4}, {5}", accountTypes, ((int)ExchangeAccountType.User), ((int)ExchangeAccountType.Mailbox), + ((int)ExchangeAccountType.Room), ((int)ExchangeAccountType.Equipment), ((int)ExchangeAccountType.DistributionList)); } List tmpAccounts = ObjectUtils.CreateListFromDataReader( @@ -2711,9 +2711,22 @@ namespace WebsitePanel.EnterpriseServer foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray()) { - if (tmpAccount.AccountType == ExchangeAccountType.SecurityGroup - ? GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) != null - : GetUserGeneralSettings(itemId, tmpAccount.AccountId) != null) + bool bSuccess = false; + + switch (tmpAccount.AccountType) + { + case ExchangeAccountType.SecurityGroup: + bSuccess = GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) != null; + break; + case ExchangeAccountType.DistributionList: + bSuccess = ExchangeServerController.GetDistributionListGeneralSettings(itemId, tmpAccount.AccountId) != null; + break; + default: + bSuccess = GetUserGeneralSettings(itemId, tmpAccount.AccountId) != null; + break; + } + + if (bSuccess) { accounts.Add(tmpAccount); } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs index 54d3fa82..951ce0d9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs @@ -276,15 +276,15 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public int AddUserToSecurityGroup(int itemId, int userAccountId, string groupName) + public int AddObjectToSecurityGroup(int itemId, int accountId, string groupName) { - return OrganizationController.AddUserToSecurityGroup(itemId, userAccountId, groupName); + return OrganizationController.AddObjectToSecurityGroup(itemId, accountId, groupName); } [WebMethod] - public int DeleteUserFromSecurityGroup(int itemId, int userAccountId, string groupName) + public int DeleteObjectFromSecurityGroup(int itemId, int accountId, string groupName) { - return OrganizationController.DeleteUserFromSecurityGroup(itemId, userAccountId, groupName); + return OrganizationController.DeleteObjectFromSecurityGroup(itemId, accountId, groupName); } [WebMethod] diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs index 02a86255..6d9650b5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs @@ -50,9 +50,9 @@ namespace WebsitePanel.Providers.HostedSolution void SetSecurityGroupGeneralSettings(string organizationId, string groupName, string[] memberAccounts, string notes); - void AddUserToSecurityGroup(string organizationId, string loginName, string groupName); + void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName); - void DeleteUserFromSecurityGroup(string organizationId, string loginName, string groupName); + void DeleteObjectFromSecurityGroup(string organizationId, string accountName, string groupName); void SetUserGeneralSettings(string organizationId, string accountName, string displayName, string password, bool hideFromAddressBook, bool disabled, bool locked, string firstName, string initials, diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index a21d05b7..7197eb88 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -5656,7 +5656,7 @@ namespace WebsitePanel.Providers.HostedSolution internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd) { - return ExecuteShellCommand(runSpace, cmd, true); + return ExecuteShellCommand(runSpace, cmd, false); } internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 82bba885..5797bf78 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -1027,56 +1027,56 @@ namespace WebsitePanel.Providers.HostedSolution entry.CommitChanges(); } - public void AddUserToSecurityGroup(string organizationId, string loginName, string groupName) + public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName) { - AddUserToSecurityGroupInternal(organizationId, loginName, groupName); + AddObjectToSecurityGroupInternal(organizationId, accountName, groupName); } - internal void AddUserToSecurityGroupInternal(string organizationId, string loginName, string groupName) + internal void AddObjectToSecurityGroupInternal(string organizationId, string accountName, string groupName) { HostedSolutionLog.LogStart("AddUserToSecurityGroupInternal"); HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId); - HostedSolutionLog.DebugInfo("loginName : {0}", loginName); + HostedSolutionLog.DebugInfo("accountName : {0}", accountName); HostedSolutionLog.DebugInfo("groupName : {0}", groupName); if (string.IsNullOrEmpty(organizationId)) throw new ArgumentNullException("organizationId"); - if (string.IsNullOrEmpty(loginName)) + if (string.IsNullOrEmpty(accountName)) throw new ArgumentNullException("loginName"); if (string.IsNullOrEmpty(groupName)) throw new ArgumentNullException("groupName"); - string userPath = GetUserPath(organizationId, loginName); + string userPath = GetObjectPath(organizationId, accountName); string groupPath = GetGroupPath(organizationId, groupName); ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath); } - public void DeleteUserFromSecurityGroup(string organizationId, string loginName, string groupName) + public void DeleteObjectFromSecurityGroup(string organizationId, string accountName, string groupName) { - DeleteUserFromSecurityGroupInternal(organizationId, loginName, groupName); + DeleteObjectFromSecurityGroupInternal(organizationId, accountName, groupName); } - internal void DeleteUserFromSecurityGroupInternal(string organizationId, string loginName, string groupName) + internal void DeleteObjectFromSecurityGroupInternal(string organizationId, string accountName, string groupName) { HostedSolutionLog.LogStart("AddUserToSecurityGroupInternal"); HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId); - HostedSolutionLog.DebugInfo("loginName : {0}", loginName); + HostedSolutionLog.DebugInfo("accountName : {0}", accountName); HostedSolutionLog.DebugInfo("groupName : {0}", groupName); if (string.IsNullOrEmpty(organizationId)) throw new ArgumentNullException("organizationId"); - if (string.IsNullOrEmpty(loginName)) + if (string.IsNullOrEmpty(accountName)) throw new ArgumentNullException("loginName"); if (string.IsNullOrEmpty(groupName)) throw new ArgumentNullException("groupName"); - string userPath = GetUserPath(organizationId, loginName); + string userPath = GetObjectPath(organizationId, accountName); string groupPath = GetGroupPath(organizationId, groupName); diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs index 260fba07..ef573e31 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs @@ -85,9 +85,9 @@ namespace WebsitePanel.Providers.HostedSolution private System.Threading.SendOrPostCallback SetSecurityGroupGeneralSettingsOperationCompleted; - private System.Threading.SendOrPostCallback AddUserToSecurityGroupOperationCompleted; + private System.Threading.SendOrPostCallback AddObjectToSecurityGroupOperationCompleted; - private System.Threading.SendOrPostCallback DeleteUserFromSecurityGroupOperationCompleted; + private System.Threading.SendOrPostCallback DeleteObjectFromSecurityGroupOperationCompleted; private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted; @@ -142,10 +142,10 @@ namespace WebsitePanel.Providers.HostedSolution public event SetSecurityGroupGeneralSettingsCompletedEventHandler SetSecurityGroupGeneralSettingsCompleted; /// - public event AddUserToSecurityGroupCompletedEventHandler AddUserToSecurityGroupCompleted; + public event AddObjectToSecurityGroupCompletedEventHandler AddObjectToSecurityGroupCompleted; /// - public event DeleteUserFromSecurityGroupCompletedEventHandler DeleteUserFromSecurityGroupCompleted; + public event DeleteObjectFromSecurityGroupCompletedEventHandler DeleteObjectFromSecurityGroupCompleted; /// public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted; @@ -704,109 +704,109 @@ namespace WebsitePanel.Providers.HostedSolution /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddUserToSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void AddUserToSecurityGroup(string organizationId, string loginName, string groupName) + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddObjectToSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName) { - this.Invoke("AddUserToSecurityGroup", new object[] { + this.Invoke("AddObjectToSecurityGroup", new object[] { organizationId, - loginName, + accountName, groupName}); } /// - public System.IAsyncResult BeginAddUserToSecurityGroup(string organizationId, string loginName, string groupName, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginAddObjectToSecurityGroup(string organizationId, string accountName, string groupName, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("AddUserToSecurityGroup", new object[] { + return this.BeginInvoke("AddObjectToSecurityGroup", new object[] { organizationId, - loginName, + accountName, groupName}, callback, asyncState); } /// - public void EndAddUserToSecurityGroup(System.IAsyncResult asyncResult) + public void EndAddObjectToSecurityGroup(System.IAsyncResult asyncResult) { this.EndInvoke(asyncResult); } /// - public void AddUserToSecurityGroupAsync(string organizationId, string loginName, string groupName) + public void AddObjectToSecurityGroupAsync(string organizationId, string accountName, string groupName) { - this.AddUserToSecurityGroupAsync(organizationId, loginName, groupName, null); + this.AddObjectToSecurityGroupAsync(organizationId, accountName, groupName, null); } /// - public void AddUserToSecurityGroupAsync(string organizationId, string loginName, string groupName, object userState) + public void AddObjectToSecurityGroupAsync(string organizationId, string accountName, string groupName, object userState) { - if ((this.AddUserToSecurityGroupOperationCompleted == null)) + if ((this.AddObjectToSecurityGroupOperationCompleted == null)) { - this.AddUserToSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddUserToSecurityGroupOperationCompleted); + this.AddObjectToSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddObjectToSecurityGroupOperationCompleted); } - this.InvokeAsync("AddUserToSecurityGroup", new object[] { + this.InvokeAsync("AddObjectToSecurityGroup", new object[] { organizationId, - loginName, - groupName}, this.AddUserToSecurityGroupOperationCompleted, userState); + accountName, + groupName}, this.AddObjectToSecurityGroupOperationCompleted, userState); } - private void OnAddUserToSecurityGroupOperationCompleted(object arg) + private void OnAddObjectToSecurityGroupOperationCompleted(object arg) { - if ((this.AddUserToSecurityGroupCompleted != null)) + if ((this.AddObjectToSecurityGroupCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.AddUserToSecurityGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + this.AddObjectToSecurityGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteUserFromSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void DeleteUserFromSecurityGroup(string organizationId, string loginName, string groupName) + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteObjectFromSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void DeleteObjectFromSecurityGroup(string organizationId, string accountName, string groupName) { - this.Invoke("DeleteUserFromSecurityGroup", new object[] { + this.Invoke("DeleteObjectFromSecurityGroup", new object[] { organizationId, - loginName, + accountName, groupName}); } /// - public System.IAsyncResult BeginDeleteUserFromSecurityGroup(string organizationId, string loginName, string groupName, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginDeleteObjectFromSecurityGroup(string organizationId, string accountName, string groupName, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("DeleteUserFromSecurityGroup", new object[] { + return this.BeginInvoke("DeleteObjectFromSecurityGroup", new object[] { organizationId, - loginName, + accountName, groupName}, callback, asyncState); } /// - public void EndDeleteUserFromSecurityGroup(System.IAsyncResult asyncResult) + public void EndDeleteObjectFromSecurityGroup(System.IAsyncResult asyncResult) { this.EndInvoke(asyncResult); } /// - public void DeleteUserFromSecurityGroupAsync(string organizationId, string loginName, string groupName) + public void DeleteObjectFromSecurityGroupAsync(string organizationId, string accountName, string groupName) { - this.DeleteUserFromSecurityGroupAsync(organizationId, loginName, groupName, null); + this.DeleteObjectFromSecurityGroupAsync(organizationId, accountName, groupName, null); } /// - public void DeleteUserFromSecurityGroupAsync(string organizationId, string loginName, string groupName, object userState) + public void DeleteObjectFromSecurityGroupAsync(string organizationId, string accountName, string groupName, object userState) { - if ((this.DeleteUserFromSecurityGroupOperationCompleted == null)) + if ((this.DeleteObjectFromSecurityGroupOperationCompleted == null)) { - this.DeleteUserFromSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteUserFromSecurityGroupOperationCompleted); + this.DeleteObjectFromSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteObjectFromSecurityGroupOperationCompleted); } - this.InvokeAsync("DeleteUserFromSecurityGroup", new object[] { + this.InvokeAsync("DeleteObjectFromSecurityGroup", new object[] { organizationId, - loginName, - groupName}, this.DeleteUserFromSecurityGroupOperationCompleted, userState); + accountName, + groupName}, this.DeleteObjectFromSecurityGroupOperationCompleted, userState); } - private void OnDeleteUserFromSecurityGroupOperationCompleted(object arg) + private void OnDeleteObjectFromSecurityGroupOperationCompleted(object arg) { - if ((this.DeleteUserFromSecurityGroupCompleted != null)) + if ((this.DeleteObjectFromSecurityGroupCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.DeleteUserFromSecurityGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + this.DeleteObjectFromSecurityGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } @@ -1619,11 +1619,11 @@ namespace WebsitePanel.Providers.HostedSolution /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - public delegate void AddUserToSecurityGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + public delegate void AddObjectToSecurityGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - public delegate void DeleteUserFromSecurityGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + public delegate void DeleteObjectFromSecurityGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs index 33d87aed..419d0ac1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs @@ -135,15 +135,15 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public void AddUserToSecurityGroup(string organizationId, string loginName, string groupName) + public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName) { - Organization.AddUserToSecurityGroup(organizationId, loginName, groupName); + Organization.AddObjectToSecurityGroup(organizationId, accountName, groupName); } [WebMethod, SoapHeader("settings")] - public void DeleteUserFromSecurityGroup(string organizationId, string loginName, string groupName) + public void DeleteObjectFromSecurityGroup(string organizationId, string accountName, string groupName) { - Organization.DeleteUserFromSecurityGroup(organizationId, loginName, groupName); + Organization.DeleteObjectFromSecurityGroup(organizationId, accountName, groupName); } [WebMethod, SoapHeader("settings")] diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index da073665..e115fdc8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5326,4 +5326,19 @@ At least one Phone number must be selected. + + Error creating user. See audit log for more details. + + + Error creating security group. See audit log for more details. + + + Error reading organization security group settings + + + Error updating organization security group settings + + + Security group general settings have been successfully updated. + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx index e55e65e6..82b33a10 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx @@ -30,12 +30,12 @@ - - + + - groupsList = new List(); + 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 newDistributionLists = new List(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 oldGroups = new List(); + 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 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 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(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx.designer.cs index 4cd03a2d..c916e030 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx.designer.cs @@ -85,22 +85,22 @@ namespace WebsitePanel.Portal.ExchangeServer { protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; /// - /// secDistributionLists control. + /// secGroups control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists; + protected global::WebsitePanel.Portal.CollapsiblePanel secGroups; /// - /// DistributionLists control. + /// GroupsPanel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel DistributionLists; + protected global::System.Web.UI.WebControls.Panel GroupsPanel; /// /// GeneralUpdatePanel control. @@ -112,13 +112,13 @@ namespace WebsitePanel.Portal.ExchangeServer { protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; /// - /// distrlists control. + /// groups control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists; + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList groups; /// /// btnSave control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx index 9e8c82cb..f60842ea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx @@ -32,12 +32,12 @@ - - + + - groupsList = new List(); + 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 newDistributionLists = new List(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 oldGroups = new List(); + 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 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 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(); } - - } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx.designer.cs index 8ae1757e..5c3b107f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxMemberOf.ascx.designer.cs @@ -85,22 +85,22 @@ namespace WebsitePanel.Portal.ExchangeServer { protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; /// - /// secDistributionLists control. + /// secGroups control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists; + protected global::WebsitePanel.Portal.CollapsiblePanel secGroups; /// - /// DistributionLists control. + /// GroupsPanel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel DistributionLists; + protected global::System.Web.UI.WebControls.Panel GroupsPanel; /// /// GeneralUpdatePanel control. @@ -112,13 +112,13 @@ namespace WebsitePanel.Portal.ExchangeServer { protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; /// - /// distrlists control. + /// groups control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists; + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList groups; /// /// btnSave control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs index 0d251711..a22efa38 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs @@ -128,7 +128,7 @@ namespace WebsitePanel.Portal.HostedSolution } catch (Exception ex) { - messageBox.ShowErrorMessage("EXCHANGE_CREATE_MAILBOX", ex); + messageBox.ShowErrorMessage("ORGANIZATION_CREATE_USER", ex); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx index 36c12744..03e0181c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx @@ -43,27 +43,17 @@ - - - + + + - - - - - - - - - - - - + DistributionListsEnabled="true" + SecurityGroupsEnabled="true" /> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.cs index cf175d4a..72cbe1dc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.cs @@ -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 groupsList = new List(); + 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 newDistributionLists = new List(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 oldGroups = new List(); + 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 newSecurityGroups = new List(securegroups.GetAccounts()); - foreach (ExchangeAccount oldgroup in oldDSecurityGroups) + foreach (ExchangeAccount secGroup in oldDistLists) { - if (newSecurityGroups.Contains(oldgroup.AccountName)) + oldGroups.Add(secGroup); + } + + IDictionary 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 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); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.designer.cs index a93df787..0b9ef9a8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.designer.cs @@ -94,76 +94,40 @@ namespace WebsitePanel.Portal.HostedSolution { protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; /// - /// secDistributionLists control. + /// secGroups control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists; + protected global::WebsitePanel.Portal.CollapsiblePanel secGroups; /// - /// DistributionListsPanel control. + /// GroupsPanel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel DistributionListsPanel; + protected global::System.Web.UI.WebControls.Panel GroupsPanel; /// - /// DLGeneralUpdatePanel control. + /// GeneralUpdatePanel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.UpdatePanel DLGeneralUpdatePanel; + protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; /// - /// distrlists control. + /// groups control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists; - - /// - /// secSecurityGroups control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secSecurityGroups; - - /// - /// SecurityGroupsPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SecurityGroupsPanel; - - /// - /// SCGeneralUpdatePanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.UpdatePanel SCGeneralUpdatePanel; - - /// - /// securegroups control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.GroupsList securegroups; + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList groups; /// /// btnSave control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx index d0a54064..75e858da 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/AccountsList.ascx @@ -37,6 +37,13 @@ + + + + + + + @@ -111,6 +118,12 @@ + + + + + + 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 6884ce2c..ae1f7d0e 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 @@ -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 selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All); + + List accountNames = new List(); + foreach (ExchangeAccount account in selectedAccounts) + accountNames.Add(account.AccountName); + + return accountNames.ToArray(); + } + + public IDictionary GetFullAccounts() { // get selected accounts List selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All); - List accountNames = new List(); - foreach (ExchangeAccount account in selectedAccounts) - accountNames.Add(account.AccountName); + IDictionary accounts = new Dictionary(); - 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 updatedAccounts = new List(); @@ -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(); 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 e8f53b78..63976c0b 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 @@ -156,6 +156,9 @@ The list of accounts is empty. Click "Add..." button to add accounts. + + Type + Display Name diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/UsersList.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/UsersList.ascx.resx index 54fc0f61..c8e8b70e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/UsersList.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/UsersList.ascx.resx @@ -153,6 +153,9 @@ The list of accounts is empty. Click "Add..." button to add accounts. + + Type + Display Name @@ -163,7 +166,7 @@ No accounts found. - Organization Users + Organization Accounts Include in search: 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 ffc23fdf..a8d0ee51 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 @@ -216,7 +216,6 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls { chkSelectAll.Enabled = false; } - } protected void chkIncludeMailboxes_CheckedChanged(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx index 5e68681b..7d41e78e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/UsersList.ascx @@ -23,7 +23,7 @@ - + @@ -31,11 +31,18 @@ - + + + + + + + + @@ -83,18 +90,24 @@ - + - + + + + + + + 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 ec47b2e2..9fad6965 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 @@ -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,