0

I have many icons across the top of the page when I first log in on the backend. I've been able to remove some icons by disabling plugins like the Rainlab Blog and Builder, but Dashboard, CMS, and Media remain there. How can I remove them?

backend login top bar

From the official documentation on extending plugins I found this:

Event::listen('backend.menu.extendItems', function($manager) {

    $manager->removeMainMenuItem('October.Cms', 'cms');
    $manager->removeSideMenuItem('October.Cms', 'cms', 'pages');

});

But I haven't found which plugin I can add this listener code to, nor the names of the Dashboard and CMS items.

Does someone know? I'll post a solution if I can find one...

icedwater
  • 4,701
  • 3
  • 35
  • 50

2 Answers2

3

You can create your own plugin and within the boot method try:

public function boot()
{
    Event::listen('backend.menu.extendItems', function($manager) {
        $manager->removeMainMenuItem('October.Cms', 'cms');
        $manager->removeMainMenuItem('October.Backend', 'media');

    });
}

The above code will remove cms and media from backend main menu. With this way the authenticated users can access the media and cms page directly by URL. If you want to block them you can do it by creating a group and disallow what you want.

Panagiotis Koursaris
  • 3,794
  • 4
  • 23
  • 46
  • 1
    The issue with this approach is: The user still can access to the controller calling directly the URL – OsDev Nov 15 '17 at 17:59
  • Is it possible to add this by default at login, or are all plugins booted when the user logs in in any case? @OsDev I am still not sure if we want to block this or just make it far less easy to access. Thanks for the heads-up though. – icedwater Nov 16 '17 at 09:40
  • @icedwater you can use this: https://github.com/OFFLINE-GmbH/oc-bootstrapper that will help you to have all of the plugins you want at the installation of octobercms. – Panagiotis Koursaris Nov 16 '17 at 14:40
  • `$navigationManager->removeMainMenuItem('October.Backend', 'media');` this does not work for me .. `$navigationManager->removeMainMenuItem('October.Cms', 'cms');` does .. btw m trying to set this for my 'owners' group. – Mittul At TechnoBrave Mar 28 '18 at 09:41
2

Instead of creating a plugin you can use ACL Group. Create one group that don't have the authorization to use "CMS" and "Media" and add an admin to it.

  • This is the simple fix I went with due to lack of time, but I would prefer a more comprehensive solution like this one: https://stackoverflow.com/a/47287486/1091386 – icedwater Nov 16 '17 at 09:38