Merge
This commit is contained in:
commit
7689703a9b
7 changed files with 65 additions and 9 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)
|
||||
{
|
||||
|
|
|
@ -2719,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())
|
||||
|
|
|
@ -399,6 +399,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
DirectoryEntry group = new DirectoryEntry(groupPath);
|
||||
|
||||
group.Invoke("Add", obj.Path);
|
||||
|
||||
group.CommitChanges();
|
||||
}
|
||||
|
||||
public static void RemoveObjectFromGroup(string obejctPath, string groupPath)
|
||||
|
@ -407,6 +409,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
DirectoryEntry group = new DirectoryEntry(groupPath);
|
||||
|
||||
group.Invoke("Remove", obj.Path);
|
||||
|
||||
group.CommitChanges();
|
||||
}
|
||||
|
||||
public static bool AdObjectExists(string path)
|
||||
|
|
|
@ -4041,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();
|
||||
|
|
|
@ -3796,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();
|
||||
|
|
|
@ -1024,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);
|
||||
}
|
||||
|
@ -1038,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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue