fixed bugs

This commit is contained in:
vfedosevich 2013-10-02 16:53:37 +03:00
parent 789f1402a6
commit dc59d2fdbb
7 changed files with 65 additions and 9 deletions

View file

@ -3771,7 +3771,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();

View file

@ -1015,12 +1015,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 +1035,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)