Pawan Singh
Jul 20, 2025
  369
(1 votes)

Disable Report and Dashboard Menu content editors

We had a requirement where Report and Dashboard menus were needed only for specific roles/users Or Admins — but not for editors.

Below is default view for editors where  you can see these menus:

But required view is: 



1.  To achieve above, we implemented a  custom Interceptor class that wraps another IMenuProvider and overrides the authorization logic as below.

using EPiServer.Shell.Navigation;
namespace alloy_example.Customization.Menus;

public class MenuProviderInterceptor : IMenuProvider
{
    private readonly IMenuProvider _menu;

    public MenuProviderInterceptor(IMenuProvider menu)
    {
        _menu = menu;
    }

    public IEnumerable<MenuItem> GetMenuItems()
    {
        var menuItems = _menu.GetMenuItems().ToList();
        menuItems.ForEach(item =>
        {           
            item.AuthorizationPolicy = "episerver:cmsadmin";
        });
        return menuItems;
    }
}


 2. we need to hook this interceptor only for specific providers — like ReportsMenuProvider or DashboardMenuProvider based on requirement.

services.Intercept<IMenuProvider>(interceptorFactory);

private static IMenuProvider interceptorFactory(IServiceProvider provider1, IMenuProvider provider2)
 {
     var types = new[] { typeof(ReportsMenuProvider), typeof(DashboardMenuProvider) };
     return types.Any(t => t.Equals(provider2.GetType())) ? new MenuProviderInterceptor(provider2) : provider2;
 }

This way, only ReportsMenuProvider and DashboardMenuProvider are affected — all other menus remain untouched. Hope this helps someone!

Jul 20, 2025

Comments

Please login to comment.
Latest blogs
AEO/GEO: A practical guide

Search changed. People ask AI tools. AI answers. Your content must be understandable, citable, and accessible to both humans and machines. That’s...

Naveed Ul-Haq | Feb 17, 2026 |

We Cloned Our Best Analyst with AI: How Our Opal Hackathon Grand Prize Winner is Changing Experimentation

Every experimentation team knows the feeling. You have a backlog of experiment ideas, but progress is bottlenecked by one critical team member, the...

Polly Walton | Feb 16, 2026

Architecting AI in Optimizely CMS: When to Use Opal vs Custom Integration

AI is rapidly becoming a core capability in modern digital experience platforms. As developers working with Optimizely CMS 12 (.NET Core), the real...

Keshav Dave | Feb 15, 2026

Reducing Web Experimentation MAU Using the REST API

Overview Optimizely Web Experimentation counts an MAU based upon the script snippet rendering for evauluation of web experiement. Therefore when yo...

Scott Reed | Feb 13, 2026