From 82a60a73fd7217c3ae0882cd12fb8c90fc2dd9a5 Mon Sep 17 00:00:00 2001 From: erikssonk Date: Tue, 17 Sep 2013 16:13:49 +0200 Subject: [PATCH 01/14] * Fixed reloading of zones on zone updates * Added two args for ReloadBIND, Arguments and zoneName * Changed the behavior of zone reloading to just reload that zone --- .../IscBind.cs | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs index d039fc1f..321a0e5f 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs @@ -30,10 +30,12 @@ using System; using System.IO; using System.Collections.Generic; using System.Text; +using System.Diagnostics; using System.ServiceProcess; using WebsitePanel.Server.Utils; using WebsitePanel.Providers.Utils; + namespace WebsitePanel.Providers.DNS { public class IscBind : HostingServiceProviderBase, IDnsServer @@ -152,9 +154,6 @@ namespace WebsitePanel.Providers.DNS // add DNS zone UpdateZone(zoneName, records); - - // reload config - ReloadBIND(); } public virtual void AddSecondaryZone(string zoneName, string[] masterServers) @@ -185,7 +184,7 @@ namespace WebsitePanel.Providers.DNS File.Create(GetZoneFilePath(zoneName)).Close(); // reload config - ReloadBIND(); + //ReloadBIND(); No need, we don't have a valid NS record, will generate a servfail on bind } public virtual DnsRecord[] GetZoneRecords(string zoneName) @@ -256,7 +255,7 @@ namespace WebsitePanel.Providers.DNS File.Delete(zonePath); // reload config - ReloadBIND(); + ReloadBIND("reconfig", ""); } #endregion @@ -912,6 +911,10 @@ namespace WebsitePanel.Providers.DNS { string path = GetZoneFilePath(zoneName); File.WriteAllText(path, zoneContent); + + // This is need so bind reloads after update else you will get serverfail if new zone + // If update the change will not be accesseble from bind + ReloadBIND("reload", zoneName); } private string GetZoneFilePath(string zoneName) @@ -924,10 +927,26 @@ namespace WebsitePanel.Providers.DNS return StringUtils.ReplaceStringVariable(ZoneFileNameTemplate, "domain_name", zoneName); } - private void ReloadBIND() + private void ReloadBIND(string Args, string zoneName) { - FileUtils.ExecuteSystemCommand(BindReloadBatch, ""); + // We don't use a bat file for reloading all zone files.. that's crazy talk + // Both bind 8 & 9 supports reloadind it's config and or reloading a single zone file + // rndc reconfig Will reload named.conf (perfect when adding a primary zone) + // rnd reload mydomain.com will reload the domain and only that domain + // Used Bind Reload Batch for inputing correct path to rndc + // Best Reguards, kenneth@cancode.se + Process rndc = new Process(); + + rndc.StartInfo.FileName = BindReloadBatch; + string rndcArguments = Args; + if (zoneName.Length > 0) { + rndcArguments += " " + zoneName; + } + rndc.StartInfo.Arguments = rndcArguments; + rndc.StartInfo.CreateNoWindow = true; + rndc.Start(); } + #endregion public override bool IsInstalled() From d8b0f858a7d8a7ebd60c20537be375f4d2a15cd5 Mon Sep 17 00:00:00 2001 From: erikssonk Date: Tue, 17 Sep 2013 16:56:39 +0200 Subject: [PATCH 02/14] Change where the ReloadBIND was calld from, also fixed a typo. --- .../WebsitePanel.Providers.DNS.Bind/IscBind.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs index 321a0e5f..77e741c5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs @@ -151,7 +151,7 @@ namespace WebsitePanel.Providers.DNS soa.PrimaryNsServer = System.Net.Dns.GetHostEntry("LocalHost").HostName; soa.PrimaryPerson = "hostmaster";//"hostmaster." + zoneName; records.Add(soa); - + ReloadBIND("reconfig", ""); // add DNS zone UpdateZone(zoneName, records); } @@ -184,7 +184,7 @@ namespace WebsitePanel.Providers.DNS File.Create(GetZoneFilePath(zoneName)).Close(); // reload config - //ReloadBIND(); No need, we don't have a valid NS record, will generate a servfail on bind + ReloadBIND("reconfig", ""); } public virtual DnsRecord[] GetZoneRecords(string zoneName) @@ -254,9 +254,9 @@ namespace WebsitePanel.Providers.DNS if (File.Exists(zonePath)) File.Delete(zonePath); - // reload config + // reload named.conf ReloadBIND("reconfig", ""); - } + } #endregion #region Resource records @@ -818,6 +818,7 @@ namespace WebsitePanel.Providers.DNS // update zone file UpdateZoneFile(zoneName, sb.ToString()); + ReloadBIND("reload", zoneName); } private string CorrectRecordName(string zoneName, string host) @@ -911,11 +912,7 @@ namespace WebsitePanel.Providers.DNS { string path = GetZoneFilePath(zoneName); File.WriteAllText(path, zoneContent); - - // This is need so bind reloads after update else you will get serverfail if new zone - // If update the change will not be accesseble from bind - ReloadBIND("reload", zoneName); - } + } private string GetZoneFilePath(string zoneName) { @@ -932,7 +929,7 @@ namespace WebsitePanel.Providers.DNS // We don't use a bat file for reloading all zone files.. that's crazy talk // Both bind 8 & 9 supports reloadind it's config and or reloading a single zone file // rndc reconfig Will reload named.conf (perfect when adding a primary zone) - // rnd reload mydomain.com will reload the domain and only that domain + // rndc reload mydomain.com will reload the domain and only that domain // Used Bind Reload Batch for inputing correct path to rndc // Best Reguards, kenneth@cancode.se Process rndc = new Process(); From 5d273cee9edfc09e3278660be07e5a9fbd990f5b Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 23 Sep 2013 16:59:41 +0300 Subject: [PATCH 03/14] add functionallity allow default default security groups --- .../HostedSolution/OrganizationController.cs | 37 ++++-- .../HostedSolution/IOrganization.cs | 4 +- .../Exchange2013.cs | 54 ++++++-- .../Exchange2007.cs | 54 ++++++-- .../Exchange2010SP2.cs | 35 +++-- .../OrganizationProvider.cs | 47 ++++--- .../OrganizationProxy.cs | 38 +++--- .../WebsitePanel.Server/Organizations.asmx.cs | 8 +- .../WebsitePanel.Server.csproj | 5 +- .../SettingsExchangePolicy.ascx.resx | 3 + .../WebsitePanel/SettingsExchangePolicy.ascx | 14 ++ .../SettingsExchangePolicy.ascx.cs | 2 + .../SettingsExchangePolicy.ascx.designer.cs | 55 ++++---- .../OrgPolicyEditor.ascx.resx | 123 ++++++++++++++++++ .../UserControls/OrgPolicyEditor.ascx | 16 +++ .../UserControls/OrgPolicyEditor.ascx.cs | 97 ++++++++++++++ .../OrgPolicyEditor.ascx.designer.cs | 60 +++++++++ .../WebsitePanel.Portal.Modules.csproj | 9 ++ 18 files changed, 546 insertions(+), 115 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/OrgPolicyEditor.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index e1b85e55..f104252b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -304,6 +304,21 @@ namespace WebsitePanel.EnterpriseServer if (OrganizationIdentifierExists(organizationId)) return BusinessErrorCodes.ERROR_ORG_ID_EXISTS; + // load user info + UserInfo user = PackageController.GetPackageOwner(packageId); + + // get letter settings + UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.EXCHANGE_POLICY); + + bool enableDefaultGroup = true; + try + { + // parse settings + string[] parts = settings["OrgPolicy"].Split(';'); + enableDefaultGroup = Convert.ToBoolean(parts[0]) && Convert.ToBoolean(parts[1]); + } + catch { /* skip */ } + // Create Organization Unit int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedOrganizations); @@ -311,7 +326,7 @@ namespace WebsitePanel.EnterpriseServer Organization org = null; if (!orgProxy.OrganizationExists(organizationId)) { - org = orgProxy.CreateOrganization(organizationId); + org = orgProxy.CreateOrganization(organizationId, enableDefaultGroup); } else return BusinessErrorCodes.ERROR_ORG_ID_EXISTS; @@ -366,16 +381,18 @@ namespace WebsitePanel.EnterpriseServer itemId = AddOrganizationToPackageItems(org, serviceId, packageId, organizationName, organizationId, domainName); // register org ID - DataProvider.AddExchangeOrganization(itemId, organizationId); // register domain DataProvider.AddExchangeOrganizationDomain(itemId, domainId, true); - //add to exchangeAcounts - AddAccount(itemId, ExchangeAccountType.DefaultSecurityGroup, org.GroupName, - org.GroupName, null, false, - 0, org.GroupName, null, 0, null); + if (enableDefaultGroup) + { + //add to exchangeAcounts + AddAccount(itemId, ExchangeAccountType.DefaultSecurityGroup, org.GroupName, + org.GroupName, null, false, + 0, org.GroupName, null, 0, null); + } // register organization domain service item OrganizationDomain orgDomain = new OrganizationDomain @@ -386,9 +403,6 @@ namespace WebsitePanel.EnterpriseServer }; PackageController.AddPackageItem(orgDomain); - - - } catch (Exception ex) { @@ -1337,7 +1351,6 @@ namespace WebsitePanel.EnterpriseServer if (!CheckUserQuota(org.Id, out errorCode)) return errorCode; - Organizations orgProxy = GetOrganizationProxy(org.ServiceId); string upn = string.Format("{0}@{1}", name, domain); @@ -1346,7 +1359,9 @@ namespace WebsitePanel.EnterpriseServer TaskManager.Write("accountName :" + sAMAccountName); TaskManager.Write("upn :" + upn); - if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled) == 0) + bool enableDefaultGroup = !string.IsNullOrEmpty(org.SecurityGroup); + + if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled, enableDefaultGroup) == 0) { accountName = sAMAccountName; OrganizationUser retUser = orgProxy.GetUserGeneralSettings(sAMAccountName, org.OrganizationId); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs index 6d9650b5..b1cbdbb6 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IOrganization.cs @@ -32,11 +32,11 @@ namespace WebsitePanel.Providers.HostedSolution { public interface IOrganization { - Organization CreateOrganization(string organizationId); + Organization CreateOrganization(string organizationId, bool enableDefaultGroup); void DeleteOrganization(string organizationId); - int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled); + int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup); void DeleteUser(string loginName, string organizationId); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index 94c4ebe7..3eb7793c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -771,28 +771,42 @@ namespace WebsitePanel.Providers.HostedSolution string server = GetServerName(); string securityGroupPath = AddADPrefix(securityGroup); - //Create mail enabled organization security group - EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId); - transaction.RegisterMailEnabledDistributionGroup(securityGroup); - UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + //Create mail enabled organization security group + EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId); + transaction.RegisterMailEnabledDistributionGroup(securityGroup); + UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer); + } //create GAL string galId = CreateGlobalAddressList(runSpace, organizationId); transaction.RegisterNewGlobalAddressList(galId); ExchangeLog.LogInfo(" Global Address List: {0}", galId); - UpdateGlobalAddressList(runSpace, galId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateGlobalAddressList(runSpace, galId, securityGroupPath); + } //create AL string alId = CreateAddressList(runSpace, organizationId); transaction.RegisterNewAddressList(alId); ExchangeLog.LogInfo(" Address List: {0}", alId); - UpdateAddressList(runSpace, alId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateAddressList(runSpace, alId, securityGroupPath); + } //create RAL string ralId = CreateRoomsAddressList(runSpace, organizationId); transaction.RegisterNewRoomsAddressList(ralId); ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId); - UpdateAddressList(runSpace, ralId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateAddressList(runSpace, ralId, securityGroupPath); + } //create ActiveSync policy string asId = CreateActiveSyncPolicy(runSpace, organizationId); @@ -880,12 +894,18 @@ namespace WebsitePanel.Providers.HostedSolution string server = GetOABGenerationServerName(); - string securityGroupId = AddADPrefix(securityGroup); - //create OAB string oabId = CreateOfflineAddressBook(runSpace, organizationId, server, oabVirtualDir); transaction.RegisterNewOfflineAddressBook(oabId); - UpdateOfflineAddressBook(runSpace, oabId, securityGroupId); + + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + string securityGroupId = AddADPrefix(securityGroup); + UpdateOfflineAddressBook(runSpace, oabId, securityGroupId); + } + info.OfflineAddressBook = oabId; } catch (Exception ex) @@ -1078,7 +1098,12 @@ namespace WebsitePanel.Providers.HostedSolution //disable mail security distribution group try { - DisableMailSecurityDistributionGroup(runSpace, securityGroup); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + DisableMailSecurityDistributionGroup(runSpace, securityGroup); + } } catch (Exception ex) { @@ -4318,7 +4343,12 @@ namespace WebsitePanel.Providers.HostedSolution string id = AddPublicFolder(runSpace, folderName, parentFolder, orgCanonicalName+"/"+GetPublicFolderMailboxName(organizationId)); transaction.RegisterNewPublicFolder(GetPublicFolderMailboxName(organizationId), id); - SetPublicFolderPermissions(runSpace, id, securityGroup); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + SetPublicFolderPermissions(runSpace, id, securityGroup); + } if (mailEnabled) { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index 7197eb88..0b9c554b 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -718,28 +718,42 @@ namespace WebsitePanel.Providers.HostedSolution string server = GetServerName(); string securityGroupPath = AddADPrefix(securityGroup); - //Create mail enabled organization security group - EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId); - transaction.RegisterMailEnabledDistributionGroup(securityGroup); - UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + //Create mail enabled organization security group + EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId); + transaction.RegisterMailEnabledDistributionGroup(securityGroup); + UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer); + } //create GAL string galId = CreateGlobalAddressList(runSpace, organizationId); transaction.RegisterNewGlobalAddressList(galId); ExchangeLog.LogInfo(" Global Address List: {0}", galId); - UpdateGlobalAddressList(runSpace, galId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateGlobalAddressList(runSpace, galId, securityGroupPath); + } //create AL string alId = CreateAddressList(runSpace, organizationId); transaction.RegisterNewAddressList(alId); ExchangeLog.LogInfo(" Address List: {0}", alId); - UpdateAddressList(runSpace, alId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateAddressList(runSpace, alId, securityGroupPath); + } //create RAL string ralId = CreateRoomsAddressList(runSpace, organizationId); transaction.RegisterNewRoomsAddressList(ralId); ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId); - UpdateAddressList(runSpace, ralId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateAddressList(runSpace, ralId, securityGroupPath); + } //create ActiveSync policy string asId = CreateActiveSyncPolicy(runSpace, organizationId); @@ -837,12 +851,18 @@ namespace WebsitePanel.Providers.HostedSolution string server = GetOABGenerationServerName(); - string securityGroupId = AddADPrefix(securityGroup); - //create OAB string oabId = CreateOfflineAddressBook(runSpace, organizationId, server, oabVirtualDir); transaction.RegisterNewOfflineAddressBook(oabId); - UpdateOfflineAddressBook(runSpace, oabId, securityGroupId); + + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + string securityGroupId = AddADPrefix(securityGroup); + UpdateOfflineAddressBook(runSpace, oabId, securityGroupId); + } + info.OfflineAddressBook = oabId; } catch (Exception ex) @@ -996,7 +1016,12 @@ namespace WebsitePanel.Providers.HostedSolution //disable mail security distribution group try { - DisableMailSecurityDistributionGroup(runSpace, securityGroup); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + DisableMailSecurityDistributionGroup(runSpace, securityGroup); + } } catch (Exception ex) { @@ -4068,7 +4093,12 @@ namespace WebsitePanel.Providers.HostedSolution string id = AddPublicFolder(runSpace, folderName, parentFolder); transaction.RegisterNewPublicFolder(string.Empty, id); - SetPublicFolderPermissions(runSpace, id, securityGroup); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + SetPublicFolderPermissions(runSpace, id, securityGroup); + } if (mailEnabled) { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs index fc3f386e..d49ccbbd 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs @@ -92,28 +92,42 @@ namespace WebsitePanel.Providers.HostedSolution string server = GetServerName(); string securityGroupPath = AddADPrefix(securityGroup); - //Create mail enabled organization security group - EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId); - transaction.RegisterMailEnabledDistributionGroup(securityGroup); - UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + //Create mail enabled organization security group + EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId); + transaction.RegisterMailEnabledDistributionGroup(securityGroup); + UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer); + } //create GAL string galId = CreateGlobalAddressList(runSpace, organizationId); transaction.RegisterNewGlobalAddressList(galId); ExchangeLog.LogInfo(" Global Address List: {0}", galId); - UpdateGlobalAddressList(runSpace, galId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateGlobalAddressList(runSpace, galId, securityGroupPath); + } //create AL string alId = CreateAddressList(runSpace, organizationId); transaction.RegisterNewAddressList(alId); ExchangeLog.LogInfo(" Address List: {0}", alId); - UpdateAddressList(runSpace, alId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateAddressList(runSpace, alId, securityGroupPath); + } //create RAL string ralId = CreateRoomsAddressList(runSpace, organizationId); transaction.RegisterNewRoomsAddressList(ralId); ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId); - UpdateAddressList(runSpace, ralId, securityGroupPath); + if (enableDefaultGroup) + { + UpdateAddressList(runSpace, ralId, securityGroupPath); + } //create ActiveSync policy string asId = CreateActiveSyncPolicy(runSpace, organizationId); @@ -283,7 +297,12 @@ namespace WebsitePanel.Providers.HostedSolution //disable mail security distribution group try { - DisableMailSecurityDistributionGroup(runSpace, securityGroup); + bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup); + + if (enableDefaultGroup) + { + DisableMailSecurityDistributionGroup(runSpace, securityGroup); + } } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 0bae0a80..3b46d193 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -206,12 +206,12 @@ namespace WebsitePanel.Providers.HostedSolution return ActiveDirectoryUtils.AdObjectExists(orgPath); } - public Organization CreateOrganization(string organizationId) + public Organization CreateOrganization(string organizationId, bool enableDefaultGroup) { - return CreateOrganizationInternal(organizationId); + return CreateOrganizationInternal(organizationId, enableDefaultGroup); } - internal Organization CreateOrganizationInternal(string organizationId) + internal Organization CreateOrganizationInternal(string organizationId, bool enableDefaultGroup) { HostedSolutionLog.LogStart("CreateOrganizationInternal"); HostedSolutionLog.DebugInfo("OrganizationId : {0}", organizationId); @@ -232,15 +232,20 @@ namespace WebsitePanel.Providers.HostedSolution ActiveDirectoryUtils.CreateOrganizationalUnit(organizationId, parentPath); ouCreated = true; - //Create security group - ActiveDirectoryUtils.CreateGroup(orgPath, organizationId); - groupCreated = true; - + if (enableDefaultGroup) + { + //Create security group + ActiveDirectoryUtils.CreateGroup(orgPath, organizationId); + groupCreated = true; + } org = new Organization(); org.OrganizationId = organizationId; org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath); - org.SecurityGroup = ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId)); + org.SecurityGroup = enableDefaultGroup + ? ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId)) + : ""; + org.GroupName = organizationId; } catch (Exception ex) @@ -356,13 +361,15 @@ namespace WebsitePanel.Providers.HostedSolution throw new ArgumentNullException("organizationId"); string groupPath = GetGroupPath(organizationId); - ActiveDirectoryUtils.DeleteADObject(groupPath); + try + { + ActiveDirectoryUtils.DeleteADObject(groupPath); + } + catch { /* skip */ } string path = GetOrganizationPath(organizationId); ActiveDirectoryUtils.DeleteADObject(path, true); - - HostedSolutionLog.LogEnd("DeleteOrganizationInternal"); } @@ -371,12 +378,12 @@ namespace WebsitePanel.Providers.HostedSolution #region Users - public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled) + public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup) { - return CreateUserInternal(organizationId, loginName, displayName, upn, password, enabled); + return CreateUserInternal(organizationId, loginName, displayName, upn, password, enabled, enableDefaultGroup); } - internal int CreateUserInternal(string organizationId, string loginName, string displayName, string upn, string password, bool enabled) + internal int CreateUserInternal(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup) { HostedSolutionLog.LogStart("CreateUserInternal"); HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId); @@ -414,12 +421,14 @@ namespace WebsitePanel.Providers.HostedSolution return Errors.AD_OBJECT_ALREADY_EXISTS; } - string groupPath = GetGroupPath(organizationId); - HostedSolutionLog.DebugInfo("Group retrieved: {0}", groupPath); + if (enableDefaultGroup) + { + string groupPath = GetGroupPath(organizationId); + HostedSolutionLog.DebugInfo("Group retrieved: {0}", groupPath); - - ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath); - HostedSolutionLog.DebugInfo("Added to group: {0}", groupPath); + ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath); + HostedSolutionLog.DebugInfo("Added to group: {0}", groupPath); + } } catch (Exception e) { diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs index ef573e31..8df2076e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/OrganizationProxy.cs @@ -224,18 +224,20 @@ namespace WebsitePanel.Providers.HostedSolution /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateOrganization", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public Organization CreateOrganization(string organizationId) + public Organization CreateOrganization(string organizationId, bool enableDefaultGroup) { object[] results = this.Invoke("CreateOrganization", new object[] { - organizationId}); + organizationId, + enableDefaultGroup}); return ((Organization)(results[0])); } /// - public System.IAsyncResult BeginCreateOrganization(string organizationId, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginCreateOrganization(string organizationId, bool enableDefaultGroup, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateOrganization", new object[] { - organizationId}, callback, asyncState); + organizationId, + enableDefaultGroup}, callback, asyncState); } /// @@ -246,20 +248,21 @@ namespace WebsitePanel.Providers.HostedSolution } /// - public void CreateOrganizationAsync(string organizationId) + public void CreateOrganizationAsync(string organizationId, bool enableDefaultGroup) { - this.CreateOrganizationAsync(organizationId, null); + this.CreateOrganizationAsync(organizationId, enableDefaultGroup, null); } /// - public void CreateOrganizationAsync(string organizationId, object userState) + public void CreateOrganizationAsync(string organizationId, bool enableDefaultGroup, object userState) { if ((this.CreateOrganizationOperationCompleted == null)) { this.CreateOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOrganizationOperationCompleted); } this.InvokeAsync("CreateOrganization", new object[] { - organizationId}, this.CreateOrganizationOperationCompleted, userState); + organizationId, + enableDefaultGroup}, this.CreateOrganizationOperationCompleted, userState); } private void OnCreateOrganizationOperationCompleted(object arg) @@ -322,7 +325,7 @@ namespace WebsitePanel.Providers.HostedSolution /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateUser", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled) + public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup) { object[] results = this.Invoke("CreateUser", new object[] { organizationId, @@ -330,12 +333,13 @@ namespace WebsitePanel.Providers.HostedSolution displayName, upn, password, - enabled}); + enabled, + enableDefaultGroup}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginCreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginCreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateUser", new object[] { organizationId, @@ -343,7 +347,8 @@ namespace WebsitePanel.Providers.HostedSolution displayName, upn, password, - enabled}, callback, asyncState); + enabled, + enableDefaultGroup}, callback, asyncState); } /// @@ -354,13 +359,13 @@ namespace WebsitePanel.Providers.HostedSolution } /// - public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled) + public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup) { - this.CreateUserAsync(organizationId, loginName, displayName, upn, password, enabled, null); + this.CreateUserAsync(organizationId, loginName, displayName, upn, password, enabled, enableDefaultGroup, null); } /// - public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, object userState) + public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup, object userState) { if ((this.CreateUserOperationCompleted == null)) { @@ -372,7 +377,8 @@ namespace WebsitePanel.Providers.HostedSolution displayName, upn, password, - enabled}, this.CreateUserOperationCompleted, userState); + enabled, + enableDefaultGroup}, this.CreateUserOperationCompleted, userState); } private void OnCreateUserOperationCompleted(object arg) diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs index 419d0ac1..14a66ff1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/Organizations.asmx.cs @@ -70,12 +70,12 @@ namespace WebsitePanel.Server [WebMethod, SoapHeader("settings")] - public Organization CreateOrganization(string organizationId) + public Organization CreateOrganization(string organizationId, bool enableDefaultGroup) { try { Log.WriteStart("'{0}' CreateOrganization", ProviderSettings.ProviderName); - Organization ret = Organization.CreateOrganization(organizationId); + Organization ret = Organization.CreateOrganization(organizationId, enableDefaultGroup); Log.WriteEnd("'{0}' CreateOrganization", ProviderSettings.ProviderName); return ret; } @@ -93,9 +93,9 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled) + public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup) { - return Organization.CreateUser(organizationId, loginName, displayName, upn, password, enabled); + return Organization.CreateUser(organizationId, loginName, displayName, upn, password, enabled, enableDefaultGroup); } [WebMethod, SoapHeader("settings")] diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index 54e11a29..e6552cc8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -19,7 +19,7 @@ v3.5 - false + true @@ -257,8 +257,7 @@ False 9004 / - - + http://localhost:9004/ False False diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangePolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangePolicy.ascx.resx index 2303aa66..05392be8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangePolicy.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangePolicy.ascx.resx @@ -123,4 +123,7 @@ Organization Id Policy + + Organization Policy + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx index 251b3972..afb86e02 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx @@ -1,6 +1,7 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsExchangePolicy.ascx.cs" Inherits="WebsitePanel.Portal.SettingsExchangePolicy" %> <%@ Register Src="UserControls/PasswordPolicyEditor.ascx" TagName="PasswordPolicyEditor" TagPrefix="wsp" %> <%@ Register Src="UserControls/OrgIdPolicyEditor.ascx" TagName="OrgIdPolicyEditor" TagPrefix="wsp" %> +<%@ Register Src="UserControls/OrgPolicyEditor.ascx" TagName="OrgPolicyEditor" TagPrefix="wsp" %> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + +
+ + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.cs index e9371049..1d2d3bbb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.cs @@ -39,12 +39,14 @@ namespace WebsitePanel.Portal // mailbox mailboxPasswordPolicy.Value = settings["MailboxPasswordPolicy"]; orgIdPolicy.Value = settings["OrgIdPolicy"]; + orgPolicy.Value = settings["OrgPolicy"]; } public void SaveSettings(UserSettings settings) { settings["MailboxPasswordPolicy"] = mailboxPasswordPolicy.Value; settings["OrgIdPolicy"] = orgIdPolicy.Value; + settings["OrgPolicy"] = orgPolicy.Value; } #endregion diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs index ae459ab0..4eca5840 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -93,5 +65,32 @@ namespace WebsitePanel.Portal { /// To modify move field declaration from designer file to code-behind file. ///
protected global::WebsitePanel.Portal.UserControls.OrgIdPolicyEditor orgIdPolicy; + + /// + /// threeOrg control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel threeOrg; + + /// + /// OrgPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel OrgPanel; + + /// + /// orgPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.OrgPolicyEditor orgPolicy; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/OrgPolicyEditor.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/OrgPolicyEditor.ascx.resx new file mode 100644 index 00000000..f97a43da --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/OrgPolicyEditor.ascx.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Enable Policy + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx new file mode 100644 index 00000000..b46bdd1d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx @@ -0,0 +1,16 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrgPolicyEditor.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.OrgPolicyEditor" %> + + + + + + + + +
+ + + +
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.cs new file mode 100644 index 00000000..ad5b8edf --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.cs @@ -0,0 +1,97 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Text; +using System.Web.UI; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class OrgPolicyEditor : UserControl + { + #region Properties + + public string Value + { + get + { + var sb = new StringBuilder(); + sb.Append(enablePolicyCheckBox.Checked.ToString()).Append(";"); + sb.Append(chkEnableDefaultGroups.Checked.ToString()).Append(";"); + + return sb.ToString(); + } + set + { + if (String.IsNullOrEmpty(value)) + { + enablePolicyCheckBox.Checked = true; + chkEnableDefaultGroups.Checked = true; + } + else + { + try + { + string[] parts = value.Split(';'); + enablePolicyCheckBox.Checked = Utils.ParseBool(parts[0], true); + chkEnableDefaultGroups.Checked = Utils.ParseBool(parts[1], true); + } + catch + { + } + } + + ToggleControls(); + } + } + + #endregion + + #region Methods + + protected void Page_Load(object sender, EventArgs e) + { + } + + private void ToggleControls() + { + PolicyTable.Visible = enablePolicyCheckBox.Checked; + } + + #endregion + + #region Event Handlers + + protected void EnablePolicy_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + #endregion + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs new file mode 100644 index 00000000..a7785222 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.UserControls { + + + public partial class OrgPolicyEditor { + + /// + /// OrgPolicyPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel OrgPolicyPanel; + + /// + /// enablePolicyCheckBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox enablePolicyCheckBox; + + /// + /// PolicyTable control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable PolicyTable; + + /// + /// lblEnableDefaultGroups control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblEnableDefaultGroups; + + /// + /// chkEnableDefaultGroups control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableDefaultGroups; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 20646721..1169106d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -493,6 +493,13 @@ SettingsLyncUserPlansPolicy.ascx + + OrgPolicyEditor.ascx + ASPXCodeBehind + + + OrgPolicyEditor.ascx + ASPXCodeBehind @@ -4021,6 +4028,7 @@ + @@ -5209,6 +5217,7 @@ Designer + Designer From 722764d22b132185c780a73a35454d49aa3eecb6 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 25 Sep 2013 12:32:29 -0400 Subject: [PATCH 04/14] Merge --- .../WebsitePanel.Server.csproj | 5 ++-- .../SettingsExchangePolicy.ascx.designer.cs | 28 +++++++++++++++++ .../OrgPolicyEditor.ascx.designer.cs | 30 ++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index e6552cc8..54e11a29 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -19,7 +19,7 @@ v3.5 - true + false @@ -257,7 +257,8 @@ False 9004 / - http://localhost:9004/ + + False False diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs index 4eca5840..a4ff245b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs index a7785222..f5521908 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // From 789f1402a63c0801cdb223a1ec5fa8a585090c98 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 27 Sep 2013 16:53:59 +0300 Subject: [PATCH 05/14] fixed issue with quotas --- .../HostedSolution/OrganizationController.cs | 4 ---- .../ExchangeServer/ExchangeDistributionListMemberOf.ascx | 4 ++-- .../ExchangeDistributionListMemberOf.ascx.designer.cs | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index e1b85e55..e3950463 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -2262,10 +2262,6 @@ namespace WebsitePanel.EnterpriseServer int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive); if (packageCheck < 0) return packageCheck; - int errorCode; - if (!CheckUserQuota(org.Id, out errorCode)) - return errorCode; - Organizations orgProxy = GetOrganizationProxy(org.ServiceId); string groupName = BuildAccountNameWithOrgId(org.OrganizationId, displayName.Replace(" ", ""), org.ServiceId); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx index 474aaa0c..82b33a10 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDistributionListMemberOf.ascx @@ -2,7 +2,7 @@ <%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/AccountsList.ascx" TagName="AccountsList" TagPrefix="wsp" %> <%@ Register Src="UserControls/MailboxSelector.ascx" TagName="MailboxSelector" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SecurityGroupTabs.ascx" TagName="SecurityGroupTabs" TagPrefix="wsp" %> +<%@ Register Src="UserControls/DistributionListTabs.ascx" TagName="DistributionListTabs" TagPrefix="wsp" %> <%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> @@ -27,7 +27,7 @@
- + 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 4344aefe..15a83891 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 @@ -101,7 +101,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SecurityGroupTabs tabs; + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.DistributionListTabs tabs; /// /// messageBox control. From a151a24e816330aa420ac2286428697159656254 Mon Sep 17 00:00:00 2001 From: erikssonk Date: Sun, 29 Sep 2013 11:46:51 +0200 Subject: [PATCH 06/14] Detect rndc.exe in BindReloadBatch var, if so use it correctly. --- .../IscBind.cs | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs index 77e741c5..923c54a7 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs @@ -926,22 +926,37 @@ namespace WebsitePanel.Providers.DNS private void ReloadBIND(string Args, string zoneName) { - // We don't use a bat file for reloading all zone files.. that's crazy talk - // Both bind 8 & 9 supports reloadind it's config and or reloading a single zone file - // rndc reconfig Will reload named.conf (perfect when adding a primary zone) - // rndc reload mydomain.com will reload the domain and only that domain - // Used Bind Reload Batch for inputing correct path to rndc - // Best Reguards, kenneth@cancode.se - Process rndc = new Process(); - rndc.StartInfo.FileName = BindReloadBatch; - string rndcArguments = Args; - if (zoneName.Length > 0) { - rndcArguments += " " + zoneName; + // Do we have a rndc.exe? if so use it - improves handling + if (BindReloadBatch.IndexOf("rndc.exe") > 0) + { + Process rndc = new Process(); + rndc.StartInfo.FileName = BindReloadBatch; + string rndcArguments = Args; + if (zoneName.Length > 0) + { + rndcArguments += " " + zoneName; + } + rndc.StartInfo.Arguments = rndcArguments; + rndc.StartInfo.CreateNoWindow = true; + rndc.Start(); + + /* + * Can't figure out how to log the output of the process to auditlog. If someone could be of assistans and fix this. + * it's rndcOutput var that should be written to audit log.s + * + string rndcOutput = ""; + while (!rndc.StandardOutput.EndOfStream) + { + rndcOutput += rndc.StandardOutput.ReadLine(); + } + */ + + } + else + { + FileUtils.ExecuteSystemCommand(BindReloadBatch, ""); } - rndc.StartInfo.Arguments = rndcArguments; - rndc.StartInfo.CreateNoWindow = true; - rndc.Start(); } #endregion From 413fca80e766813649fc9f3c03d250c58494498f Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Sep 2013 16:58:04 -0400 Subject: [PATCH 07/14] Added tag build-2.1.0.173 for changeset 0c1bb753d3f9 From b9b2a2d1ad2a6f4060fa6eb1797470644a8d2ba5 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Sep 2013 17:01:41 -0400 Subject: [PATCH 08/14] Added tag build-2.1.0.174 for changeset 477982a007d7 From 69600780425de160ae22d0937749dfca79c5cba6 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Sep 2013 17:05:10 -0400 Subject: [PATCH 09/14] Added tag build-2.1.0.175 for changeset 7677a6a9becf From 4bcc1711e4ec080364f12f8707dced42b6aa13f4 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Sep 2013 17:08:35 -0400 Subject: [PATCH 10/14] Added tag build-2.1.0.176 for changeset 284fd912b5ca From 726ea32cbb8fcca6c5e889598489e4ec4b795f38 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Sep 2013 17:12:07 -0400 Subject: [PATCH 11/14] Added tag build-2.1.0.177 for changeset 5717dffa7328 From 07f6ab46df3b17281c5c7e4d8f5a2714ccebb90f Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Sep 2013 17:15:35 -0400 Subject: [PATCH 12/14] Added tag build-2.1.0.178 for changeset 141fcd27ac15 From dc59d2fdbb2c9633adc895d5491e54e5925dc642 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 2 Oct 2013 16:53:37 +0300 Subject: [PATCH 13/14] fixed bugs --- .../ExchangeServer/ExchangeServerController.cs | 3 +-- .../HostedSolution/OrganizationController.cs | 15 ++++++++++++++- .../HostedSolution/ActiveDirectoryUtils.cs | 4 ++++ .../Exchange2013.cs | 18 ++++++++++++++++++ .../Exchange2007.cs | 18 ++++++++++++++++++ .../OrganizationProvider.cs | 14 +++++++++----- .../OrganizationUserMemberOf.ascx.cs | 2 +- 7 files changed, 65 insertions(+), 9 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 1513a736..dc6de57b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -3993,8 +3993,7 @@ namespace WebsitePanel.EnterpriseServer List DistributionLists = GetAccounts(itemId, ExchangeAccountType.DistributionList); foreach (ExchangeAccount DistributionAccount in DistributionLists) { - //ExchangeDistributionList DistributionList = exchange.GetDistributionListGeneralSettings(DistributionAccount.AccountName); - OrganizationSecurityGroup DistributionList = OrganizationController.GetSecurityGroupGeneralSettings(itemId, DistributionAccount.AccountId); + ExchangeDistributionList DistributionList = exchange.GetDistributionListGeneralSettings(DistributionAccount.AccountName); foreach (ExchangeAccount member in DistributionList.MembersAccounts) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index e3950463..e3c9d25a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -2704,18 +2704,31 @@ namespace WebsitePanel.EnterpriseServer #endregion + // load organization + Organization org = (Organization)PackageController.GetPackageItem(itemId); + if (org == null) + return null; + string accountTypes = string.Format("{0}", ((int)ExchangeAccountType.SecurityGroup)); if (!includeOnlySecurityGroups) { - accountTypes = string.Format("{0}, {1}, {2}, {3}, {4}, {5}", accountTypes, ((int)ExchangeAccountType.User), ((int)ExchangeAccountType.Mailbox), + accountTypes = string.Format("{0}, {1}", accountTypes, ((int)ExchangeAccountType.User)); + + int exchangeServiceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.Exchange); + + if (exchangeServiceId != 0) + { + accountTypes = string.Format("{0}, {1}, {2}, {3}, {4}", accountTypes, ((int)ExchangeAccountType.Mailbox), ((int)ExchangeAccountType.Room), ((int)ExchangeAccountType.Equipment), ((int)ExchangeAccountType.DistributionList)); + } } List tmpAccounts = ObjectUtils.CreateListFromDataReader( DataProvider.SearchExchangeAccountsByTypes(SecurityContext.User.UserId, itemId, accountTypes, filterColumn, filterValue, sortColumn)); + List accounts = new List(); foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray()) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs index ed0332dc..1e5abee9 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs @@ -399,6 +399,8 @@ namespace WebsitePanel.Providers.HostedSolution DirectoryEntry group = new DirectoryEntry(groupPath); group.Invoke("Add", obj.Path); + + group.CommitChanges(); } public static void RemoveObjectFromGroup(string obejctPath, string groupPath) @@ -407,6 +409,8 @@ namespace WebsitePanel.Providers.HostedSolution DirectoryEntry group = new DirectoryEntry(groupPath); group.Invoke("Remove", obj.Path); + + group.CommitChanges(); } public static bool AdObjectExists(string path) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index 94c4ebe7..021b1bbc 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -4016,7 +4016,25 @@ namespace WebsitePanel.Providers.HostedSolution id = GetPSObjectIdentity(obj); account = GetExchangeAccount(runSpace, id); if (account != null) + { list.Add(account); + } + else + { + string distinguishedName = (string)GetPSObjectProperty(obj, "DistinguishedName"); + string path = ActiveDirectoryUtils.AddADPrefix(distinguishedName, PrimaryDomainController); + + if (ActiveDirectoryUtils.AdObjectExists(path)) + { + DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path); + + list.Add(new ExchangeAccount + { + AccountName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName), + AccountType = ExchangeAccountType.SecurityGroup + }); + } + } } ExchangeLog.LogEnd("GetGroupMembers"); return list.ToArray(); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index 7197eb88..481509f5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -3771,7 +3771,25 @@ namespace WebsitePanel.Providers.HostedSolution id = GetPSObjectIdentity(obj); account = GetExchangeAccount(runSpace, id); if (account != null) + { list.Add(account); + } + else + { + string distinguishedName = (string)GetPSObjectProperty(obj, "DistinguishedName"); + string path = ActiveDirectoryUtils.AddADPrefix(distinguishedName, PrimaryDomainController); + + if (ActiveDirectoryUtils.AdObjectExists(path)) + { + DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path); + + list.Add(new ExchangeAccount + { + AccountName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName), + AccountType = ExchangeAccountType.SecurityGroup + }); + } + } } ExchangeLog.LogEnd("GetGroupMembers"); return list.ToArray(); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 0bae0a80..68c774e3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -1015,12 +1015,18 @@ namespace WebsitePanel.Providers.HostedSolution ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Notes, notes); - foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user")) + entry.CommitChanges(); + + string orgPath = GetOrganizationPath(organizationId); + + DirectoryEntry orgEntry = ActiveDirectoryUtils.GetADObject(orgPath); + + foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user", orgEntry)) { ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, path); } - foreach (string groupPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "group")) + foreach (string groupPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "group", orgEntry)) { ActiveDirectoryUtils.RemoveObjectFromGroup(groupPath, path); } @@ -1029,9 +1035,7 @@ namespace WebsitePanel.Providers.HostedSolution { string objPath = GetObjectPath(organizationId, obj); ActiveDirectoryUtils.AddObjectToGroup(objPath, path); - } - - entry.CommitChanges(); + } } public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName) 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 e5846c99..944db3e3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserMemberOf.ascx.cs @@ -90,7 +90,7 @@ namespace WebsitePanel.Portal.HostedSolution // get settings OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID); - groups.DistributionListsEnabled = (user.AccountType == ExchangeAccountType.Mailbox + groups.DistributionListsEnabled = EnableDistributionLists && (user.AccountType == ExchangeAccountType.Mailbox || user.AccountType == ExchangeAccountType.Room || user.AccountType == ExchangeAccountType.Equipment); From a1f10d631e26134a6d580424b368d7072dce76f4 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 2 Oct 2013 11:06:47 -0400 Subject: [PATCH 14/14] Added tag build-2.1.0.179 for changeset 1beaff5360e6