Merge
This commit is contained in:
commit
31f7928a12
7 changed files with 65 additions and 9 deletions
|
@ -3993,8 +3993,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
List<ExchangeAccount> DistributionLists = GetAccounts(itemId, ExchangeAccountType.DistributionList);
|
List<ExchangeAccount> DistributionLists = GetAccounts(itemId, ExchangeAccountType.DistributionList);
|
||||||
foreach (ExchangeAccount DistributionAccount in DistributionLists)
|
foreach (ExchangeAccount DistributionAccount in DistributionLists)
|
||||||
{
|
{
|
||||||
//ExchangeDistributionList DistributionList = exchange.GetDistributionListGeneralSettings(DistributionAccount.AccountName);
|
ExchangeDistributionList DistributionList = exchange.GetDistributionListGeneralSettings(DistributionAccount.AccountName);
|
||||||
OrganizationSecurityGroup DistributionList = OrganizationController.GetSecurityGroupGeneralSettings(itemId, DistributionAccount.AccountId);
|
|
||||||
|
|
||||||
foreach (ExchangeAccount member in DistributionList.MembersAccounts)
|
foreach (ExchangeAccount member in DistributionList.MembersAccounts)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2719,18 +2719,31 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
// load organization
|
||||||
|
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||||
|
if (org == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
string accountTypes = string.Format("{0}", ((int)ExchangeAccountType.SecurityGroup));
|
string accountTypes = string.Format("{0}", ((int)ExchangeAccountType.SecurityGroup));
|
||||||
|
|
||||||
if (!includeOnlySecurityGroups)
|
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));
|
((int)ExchangeAccountType.Room), ((int)ExchangeAccountType.Equipment), ((int)ExchangeAccountType.DistributionList));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<ExchangeAccount> tmpAccounts = ObjectUtils.CreateListFromDataReader<ExchangeAccount>(
|
List<ExchangeAccount> tmpAccounts = ObjectUtils.CreateListFromDataReader<ExchangeAccount>(
|
||||||
DataProvider.SearchExchangeAccountsByTypes(SecurityContext.User.UserId, itemId,
|
DataProvider.SearchExchangeAccountsByTypes(SecurityContext.User.UserId, itemId,
|
||||||
accountTypes, filterColumn, filterValue, sortColumn));
|
accountTypes, filterColumn, filterValue, sortColumn));
|
||||||
|
|
||||||
|
|
||||||
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
|
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
|
||||||
|
|
||||||
foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
|
foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
|
||||||
|
|
|
@ -399,6 +399,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
DirectoryEntry group = new DirectoryEntry(groupPath);
|
DirectoryEntry group = new DirectoryEntry(groupPath);
|
||||||
|
|
||||||
group.Invoke("Add", obj.Path);
|
group.Invoke("Add", obj.Path);
|
||||||
|
|
||||||
|
group.CommitChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveObjectFromGroup(string obejctPath, string groupPath)
|
public static void RemoveObjectFromGroup(string obejctPath, string groupPath)
|
||||||
|
@ -407,6 +409,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
DirectoryEntry group = new DirectoryEntry(groupPath);
|
DirectoryEntry group = new DirectoryEntry(groupPath);
|
||||||
|
|
||||||
group.Invoke("Remove", obj.Path);
|
group.Invoke("Remove", obj.Path);
|
||||||
|
|
||||||
|
group.CommitChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AdObjectExists(string path)
|
public static bool AdObjectExists(string path)
|
||||||
|
|
|
@ -4041,8 +4041,26 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
id = GetPSObjectIdentity(obj);
|
id = GetPSObjectIdentity(obj);
|
||||||
account = GetExchangeAccount(runSpace, id);
|
account = GetExchangeAccount(runSpace, id);
|
||||||
if (account != null)
|
if (account != null)
|
||||||
|
{
|
||||||
list.Add(account);
|
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");
|
ExchangeLog.LogEnd("GetGroupMembers");
|
||||||
return list.ToArray();
|
return list.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3796,8 +3796,26 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
id = GetPSObjectIdentity(obj);
|
id = GetPSObjectIdentity(obj);
|
||||||
account = GetExchangeAccount(runSpace, id);
|
account = GetExchangeAccount(runSpace, id);
|
||||||
if (account != null)
|
if (account != null)
|
||||||
|
{
|
||||||
list.Add(account);
|
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");
|
ExchangeLog.LogEnd("GetGroupMembers");
|
||||||
return list.ToArray();
|
return list.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1024,12 +1024,18 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
|
|
||||||
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Notes, notes);
|
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);
|
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);
|
ActiveDirectoryUtils.RemoveObjectFromGroup(groupPath, path);
|
||||||
}
|
}
|
||||||
|
@ -1039,8 +1045,6 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string objPath = GetObjectPath(organizationId, obj);
|
string objPath = GetObjectPath(organizationId, obj);
|
||||||
ActiveDirectoryUtils.AddObjectToGroup(objPath, path);
|
ActiveDirectoryUtils.AddObjectToGroup(objPath, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.CommitChanges();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName)
|
public void AddObjectToSecurityGroup(string organizationId, string accountName, string groupName)
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace WebsitePanel.Portal.HostedSolution
|
||||||
// get settings
|
// get settings
|
||||||
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID);
|
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.Room
|
||||||
|| user.AccountType == ExchangeAccountType.Equipment);
|
|| user.AccountType == ExchangeAccountType.Equipment);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue