From 34af4912e8455e730db716e05f08534214699d01 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 3 Sep 2013 14:24:08 +0300 Subject: [PATCH] fixed bugs --- .../HostedSolution/ActiveDirectoryUtils.cs | 12 +++++++++++- .../OrganizationProvider.cs | 7 +++++-- .../OrganizationSecurityGroupGeneralSettings.ascx.cs | 1 + .../OrganizationSecurityGroupMemberOf.ascx.cs | 1 - .../UserControls/SecurityGroupTabs.ascx.cs | 12 +++++++++++- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs index b6dc0c92..27b223eb 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs @@ -46,7 +46,12 @@ namespace WebsitePanel.Providers.HostedSolution public static string[] GetGroupObjects(string group, string objectType) { - List rets = new List(); + return GetGroupObjects(group, objectType, null); + } + + public static string[] GetGroupObjects(string group, string objectType, DirectoryEntry entry) + { + List rets = new List(); DirectorySearcher deSearch = new DirectorySearcher { @@ -54,6 +59,11 @@ namespace WebsitePanel.Providers.HostedSolution "(&(objectClass=" + objectType + "))" }; + if (entry != null) + { + deSearch.SearchRoot = entry; + } + SearchResultCollection srcObjects = deSearch.FindAll(); foreach (SearchResult srcObject in srcObjects) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 9d7760a8..09089959 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -918,8 +918,11 @@ namespace WebsitePanel.Providers.HostedSolution throw new ArgumentNullException("groupName"); string path = GetGroupPath(organizationId, groupName); + string organizationPath = GetOrganizationPath(organizationId); DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path); + DirectoryEntry organizationEntry = ActiveDirectoryUtils.GetADObject(organizationPath); + OrganizationSecurityGroup securityGroup = new OrganizationSecurityGroup(); @@ -930,7 +933,7 @@ namespace WebsitePanel.Providers.HostedSolution List members = new List(); - foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user")) + foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user", organizationEntry)) { OrganizationUser tmpUser = GetUser(userPath); @@ -941,7 +944,7 @@ namespace WebsitePanel.Providers.HostedSolution }); } - foreach (string groupPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "group")) + foreach (string groupPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "group", organizationEntry)) { DirectoryEntry groupEntry = ActiveDirectoryUtils.GetADObject(groupPath); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupGeneralSettings.ascx.cs index 1c0d244b..7ebfe3f9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupGeneralSettings.ascx.cs @@ -76,6 +76,7 @@ namespace WebsitePanel.Portal.ExchangeServer members.Enabled = false; btnSave.Visible = false; + tabs.IsDefault = true; } } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupMemberOf.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupMemberOf.ascx.cs index 92ccfc77..9b7fc8fa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupMemberOf.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationSecurityGroupMemberOf.ascx.cs @@ -51,7 +51,6 @@ namespace WebsitePanel.Portal.HostedSolution { // get settings OrganizationSecurityGroup group = ES.Services.Organizations.GetSecurityGroupGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID); - //OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID); litDisplayName.Text = group.DisplayName; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/SecurityGroupTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/SecurityGroupTabs.ascx.cs index 9e83947b..51c698f7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/SecurityGroupTabs.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/SecurityGroupTabs.ascx.cs @@ -44,6 +44,13 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls set { selectedTab = value; } } + private bool isDefault = false; + public bool IsDefault + { + get { return isDefault; } + set { isDefault = value; } + } + protected void Page_Load(object sender, EventArgs e) { BindTabs(); @@ -53,7 +60,10 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls { List tabsList = new List(); tabsList.Add(CreateTab("secur_group_settings", "Tab.Settings")); - tabsList.Add(CreateTab("secur_group_memberof", "Tab.MemberOf")); + if (!isDefault) + { + tabsList.Add(CreateTab("secur_group_memberof", "Tab.MemberOf")); + } PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);