Jump to content

Recommended Posts

Posted

Good day!

I need to make custom admin interface for specific user role. I want them to only see those menus and menu items I selected. I do not want them to see "Pages". I plan to use custom Process modules under custom admin menu.

But I do want to use PageEdit admin interface for editing pages. To make it possible, I have to set edit permission to the pages they are to edit. But that uncovers "Pages" menu for them.

How can I achieve that, still using defaul or Reno admin theme? Or is it preferable to make my own?

Posted (edited)

Place something alike in your init and user with role 'your-role' won't see Pages
 

$this->addHookAfter('Page::viewable', function($event) {
    // 3 is the ID of Pages
    if ($event->object->id === 3 && $this->user->hasRole('your-role')) {
        $event->return = false;
    }
});

ps, code is not tested...

Edited by Martijn Geerts
typo fix in code
  • Like 5

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...