+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Hide the "Tools" menu item from certain roles

Hide the "Tools" menu item from certain roles

5 posts, 0 answered
  1. Dan
    Dan avatar
    11 posts
    Registered:
    17 Sep 2012
    25 Jan 2011
    Link to this post
    I have recently done some customizing of the users.aspx based on the role of the logged in user, hiding much of the functionality for one role.  As part of that implementation, I would also like to hide the "Tools" menu item from users of this same role.  Does anyone know how to affect what items appear in the top menus (besides through setting permissions)?  This role type is given CMS Access and Manage Users access, which means they see "Users" and "Tools" under the "Administration" section.  I would like to prevent them from seeing the "Tools" option, as I don't want them to have the ability to export the site as a template.

    Thanks,
    DanO
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 Jan 2011
    Link to this post
    Hi Dan,

    Please take a look at this blog post: How to hide controls from toolbox section in Sitefinity.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Dan
    Dan avatar
    11 posts
    Registered:
    17 Sep 2012
    26 Jan 2011
    Link to this post
    The post you forwarded is addressing a different issue - that is the toolbox in the right hand menu when editing a page.  I am talking about the main navigation items at the top of the layout.  See the attached screenshot.

    I want to hide the "Tools" menu item from users of a particular role.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Jan 2011
    Link to this post
    Hi Dan,

    Open Sitefinity/Admin/Admin.master.cs  and inside  MainMenu_DataBound you can access the RadTabStrip items collection

    IList<RadTab> tabsCollection = MainMenu.GetAllTabs();

    and hide the tab you want to remove.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Dan
    Dan avatar
    11 posts
    Registered:
    17 Sep 2012
    26 Jan 2011
    Link to this post
    Ivan,

    Thanks - that set me in the right direction.  Since the item I want to hide is in the second level of the rad strip, I had to find the parent, and then remove the child from the parent.  I'm posting the code for anyone that may be interested.  If this wasn't just a one-off, it would probably make sense to create a recursive function that could walk the tree, as this isn't a very elegant solution...

    if (UserManager.IsCurrentUserInRole("custom role"))
    {
      RadTab item = MainMenu.FindTabByText("Administration");
      if (item != null)
      {
        RadTab child = MainMenu.Tabs[item.Index].Tabs.FindTabByText("Tools");
        MainMenu.Tabs[item.Index].Tabs.Remove(child);
      }
    }

    Thanks, DanO
Register for webinar
5 posts, 0 answered