I'm not sure if this is possible, but I'd like to limit my users to specific areas of an Intranet site based on their membership in specific Global Groups created in SQL Server.
For example, I've got the following menu in ASP:
<div class="clear hideSkiplink" id="MainMenu">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
IncludeStyleBlock="False" Orientation="Horizontal"
BackColor="#CC3300">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home" Selectable="true" />
<asp:MenuItem NavigateUrl="~/Forms/frmCensusList.aspx" Text="Census Editing"/>
<asp:MenuItem NavigateUrl="~/Forms/frmRoster.aspx" Text="Roster Editing"/>
<asp:MenuItem NavigateUrl="~/Forms/frmReportMenu.aspx" Text="Reporting"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
<%-- <asp:MenuItem NavigateUrl="~/WebForm1.aspx" Text="Test"/>--%>
</Items>
</asp:Menu>
</div>
And then the following in the Code Behind that limits what "security level" can see the "About" page:
protected void Page_Load(object sender, EventArgs e)
{
string path = Request.AppRelativeCurrentExecutionFilePath;
foreach (MenuItem item in NavigationMenu.Items)
{
item.Selected = item.NavigateUrl.Equals(path, StringComparison.InvariantCultureIgnoreCase);
}
// If the user isn't an Admin, hide the About menu option
string ActiveUser = System.Web.HttpContext.Current.User.Identity.Name;
string SecurityLevel = ActiveUser.SecLevel();
if (SecurityLevel != "ADMIN")
{
MenuItem mnuItem = NavigationMenu.FindItem("About"); // Find particular item
if (mnuItem != null)
{
NavigationMenu.Items.Remove(mnuItem);
}
}
}
SecLevel() is a function I created that's based on a table of user's IDs, but maintaining the table is a pain, plus future projects are going to be a pain to compile the original table, and it will just be easier if I can do this based on existing Global Groups.
Anyone got any suggestions?