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