diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config index 9afcf166..efd04273 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config @@ -2,15 +2,15 @@ - - - - - - - - - + + + + + + + + + @@ -24,7 +24,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalConfiguration.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalConfiguration.cs index 4d95ee7e..5de61c70 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalConfiguration.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalConfiguration.cs @@ -290,6 +290,9 @@ namespace WebsitePanel.WebPortal else page.Roles.AddRange(xmlPage.Attributes["roles"].Value.Split(ROLES_DELIMITERS.ToCharArray())); + if (xmlPage.Attributes["selectedUserContext"] != null) + page.Roles.AddRange(xmlPage.Attributes["selectedUserContext"].Value.Split(ROLES_DELIMITERS.ToCharArray())); + page.Enabled = (xmlPage.Attributes["enabled"] != null) ? Boolean.Parse(xmlPage.Attributes["enabled"].Value) : true; page.Hidden = (xmlPage.Attributes["hidden"] != null) ? Boolean.Parse(xmlPage.Attributes["hidden"].Value) : false; page.SkinSrc = (xmlPage.Attributes["skin"] != null) ? xmlPage.Attributes["skin"].Value : null; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMenu.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMenu.ascx.cs index 032aa19d..7652383e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMenu.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMenu.ascx.cs @@ -85,6 +85,10 @@ namespace WebsitePanel.Portal string roles = null; if (node.Attributes["roles"] != null) roles = node.Attributes["roles"].Value; + + string selectedUserContext = null; + if (node.Attributes["selectedUserContext"] != null) + selectedUserContext = node.Attributes["selectedUserContext"].Value; // get custom page parameters XmlNodeList xmlParameters = node.SelectNodes("Parameters/Add"); @@ -97,7 +101,22 @@ namespace WebsitePanel.Portal bool display = true; // set user role visibility second - if (!String.IsNullOrEmpty(roles)) + if (!String.IsNullOrEmpty(selectedUserContext)) + { + display = false; + string[] arrRoles = selectedUserContext.Split(','); + string userRole = PanelSecurity.SelectedUser.Role.ToString(); + foreach (string role in arrRoles) + { + if (String.Compare(userRole, role, true) == 0) + { + display = true; + break; + } + } + } + + if ((!String.IsNullOrEmpty(roles)) & display) { display = false; string[] arrRoles = roles.Split(',');