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 e1b85e55..481f4059 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); @@ -2262,10 +2277,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); @@ -2708,18 +2719,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 ed271941..96a069de 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs @@ -397,6 +397,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) @@ -405,6 +407,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.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.DNS.Bind/IscBind.cs b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.Bind/IscBind.cs index d039fc1f..923c54a7 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 @@ -149,12 +151,9 @@ 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); - - // 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("reconfig", ""); } public virtual DnsRecord[] GetZoneRecords(string zoneName) @@ -255,9 +254,9 @@ namespace WebsitePanel.Providers.DNS if (File.Exists(zonePath)) File.Delete(zonePath); - // reload config - ReloadBIND(); - } + // reload named.conf + ReloadBIND("reconfig", ""); + } #endregion #region Resource records @@ -819,6 +818,7 @@ namespace WebsitePanel.Providers.DNS // update zone file UpdateZoneFile(zoneName, sb.ToString()); + ReloadBIND("reload", zoneName); } private string CorrectRecordName(string zoneName, string host) @@ -912,7 +912,7 @@ namespace WebsitePanel.Providers.DNS { string path = GetZoneFilePath(zoneName); File.WriteAllText(path, zoneContent); - } + } private string GetZoneFilePath(string zoneName) { @@ -924,10 +924,41 @@ namespace WebsitePanel.Providers.DNS return StringUtils.ReplaceStringVariable(ZoneFileNameTemplate, "domain_name", zoneName); } - private void ReloadBIND() + private void ReloadBIND(string Args, string zoneName) { - FileUtils.ExecuteSystemCommand(BindReloadBatch, ""); + + // 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, ""); + } } + #endregion public override bool IsInstalled() diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index bb0392cb..08830b70 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) { @@ -4016,7 +4041,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(); @@ -4318,7 +4361,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..4f7c3527 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) { @@ -3771,7 +3796,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(); @@ -4068,7 +4111,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..7fb2a099 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) { @@ -1015,12 +1024,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 +1044,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.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.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/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. 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); 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..a4ff245b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangePolicy.ascx.designer.cs @@ -93,5 +93,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..f5521908 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrgPolicyEditor.ascx.designer.cs @@ -0,0 +1,88 @@ +// 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. +// +// 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; + } +}