merge commit
This commit is contained in:
commit
097b3fe90b
22 changed files with 673 additions and 111 deletions
|
@ -3993,8 +3993,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
List<ExchangeAccount> 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)
|
||||
{
|
||||
|
|
|
@ -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<ExchangeAccount> tmpAccounts = ObjectUtils.CreateListFromDataReader<ExchangeAccount>(
|
||||
DataProvider.SearchExchangeAccountsByTypes(SecurityContext.User.UserId, itemId,
|
||||
accountTypes, filterColumn, filterValue, sortColumn));
|
||||
|
||||
|
||||
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
|
||||
|
||||
foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -1030,8 +1045,6 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
string objPath = GetObjectPath(organizationId, obj);
|
||||
ActiveDirectoryUtils.AddObjectToGroup(objPath, path);
|
||||
}
|
||||
|
||||
entry.CommitChanges();
|
||||
}
|
||||
|
||||
public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName)
|
||||
|
|
|
@ -224,18 +224,20 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
/// <remarks/>
|
||||
[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]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -246,20 +248,21 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void CreateOrganizationAsync(string organizationId)
|
||||
public void CreateOrganizationAsync(string organizationId, bool enableDefaultGroup)
|
||||
{
|
||||
this.CreateOrganizationAsync(organizationId, null);
|
||||
this.CreateOrganizationAsync(organizationId, enableDefaultGroup, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
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
|
|||
/// <remarks/>
|
||||
[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]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -354,13 +359,13 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
}
|
||||
|
||||
/// <remarks/>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
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)
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -123,4 +123,7 @@
|
|||
<data name="secOrg.Text" xml:space="preserve">
|
||||
<value>Organization Id Policy</value>
|
||||
</data>
|
||||
<data name="threeOrg.Text" xml:space="preserve">
|
||||
<value>Organization Policy</value>
|
||||
</data>
|
||||
</root>
|
|
@ -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 @@
|
|||
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
|
||||
</div>
|
||||
<div class="FormBody">
|
||||
<wsp:SecurityGroupTabs id="tabs" runat="server" SelectedTab="secur_group_memberof" />
|
||||
<wsp:DistributionListTabs id="tabs" runat="server" SelectedTab="dlist_memberof" />
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<wsp:CollapsiblePanel id="secGroups" runat="server" TargetControlID="GroupsPanel" meta:resourcekey="secGroups" Text="Groups"></wsp:CollapsiblePanel>
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SecurityGroupTabs tabs;
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.DistributionListTabs tabs;
|
||||
|
||||
/// <summary>
|
||||
/// messageBox control.
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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" %>
|
||||
|
||||
<wsp:CollapsiblePanel id="secMailboxPassword" runat="server"
|
||||
|
@ -30,3 +31,16 @@
|
|||
</tr>
|
||||
</table>
|
||||
</asp:Panel>
|
||||
|
||||
<wsp:CollapsiblePanel id="threeOrg" runat="server" TargetControlID="OrgPanel" meta:resourcekey="threeOrg" Text="Organization Policy"/>
|
||||
<asp:Panel ID="OrgPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="SubHead" width="150" nowrap>
|
||||
</td>
|
||||
<td>
|
||||
<wsp:OrgPolicyEditor id="orgPolicy" runat="server" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</asp:Panel>
|
|
@ -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
|
||||
|
|
|
@ -93,5 +93,32 @@ namespace WebsitePanel.Portal {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.UserControls.OrgIdPolicyEditor orgIdPolicy;
|
||||
|
||||
/// <summary>
|
||||
/// threeOrg control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel threeOrg;
|
||||
|
||||
/// <summary>
|
||||
/// OrgPanel control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel OrgPanel;
|
||||
|
||||
/// <summary>
|
||||
/// orgPolicy control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.UserControls.OrgPolicyEditor orgPolicy;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="enablePolicyCheckBox.Text" xml:space="preserve">
|
||||
<value>Enable Policy</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,16 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrgPolicyEditor.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.OrgPolicyEditor" %>
|
||||
<asp:UpdatePanel runat="server" ID="OrgPolicyPanel" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
<asp:CheckBox id="enablePolicyCheckBox" runat="server" meta:resourcekey="enablePolicyCheckBox" Text="Enable Policy" CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="EnablePolicy_CheckedChanged"/>
|
||||
<table id="PolicyTable" runat="server" cellpadding="2">
|
||||
<tr>
|
||||
<td class="Normal" style="width:150px;">
|
||||
<asp:Label ID="lblEnableDefaultGroups" runat="server" meta:resourcekey="lblEnableDefaultGroups" Text="Enable Default Groups:"/>
|
||||
</td>
|
||||
<td class="Normal">
|
||||
<asp:CheckBox ID="chkEnableDefaultGroups" runat="server" CssClass="NormalTextBox" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebsitePanel.Portal.UserControls {
|
||||
|
||||
|
||||
public partial class OrgPolicyEditor {
|
||||
|
||||
/// <summary>
|
||||
/// OrgPolicyPanel control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel OrgPolicyPanel;
|
||||
|
||||
/// <summary>
|
||||
/// enablePolicyCheckBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox enablePolicyCheckBox;
|
||||
|
||||
/// <summary>
|
||||
/// PolicyTable control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTable PolicyTable;
|
||||
|
||||
/// <summary>
|
||||
/// lblEnableDefaultGroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblEnableDefaultGroups;
|
||||
|
||||
/// <summary>
|
||||
/// chkEnableDefaultGroups control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox chkEnableDefaultGroups;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue