How to integrate the admin menu in a custom module and make it available for a logged in user only #6901
-
So I've followed the Add an admin menu steps. Thanks to that and the input in another discussion I successfully created my custom module with it's own logic. When i start the CMS and navigate to my custom module through the menu the menu disappears. My first question is, how do i include the admin menu, so that i can navigate easily from and to my custom module? The second question is, how can i make sure that only a admin or editor can see the module? Right now a user that is not logged in can directly navigate to the page and use the custom module. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I don't really understand, can you elaborate? When does your menu disappear exactly? Does that mean that you see it once though? You can tie menu items to permissions like this, and then you can grant only the Editor role that permission. For this, you can use one of the built-in permissions too but probably a better idea is to add your own into your module like this. Do note that authorizing the menu item is just that: It'll hide the menu for unauthorized users but if they know the URL of whatever the menu points to, they'll still be able to visit it. If you want authorization in your own controller, for example, do it like this. |
Beta Was this translation helpful? Give feedback.
-
Thanks guys, once again you are such great help. I’ve created the custom permissions and added the |
Beta Was this translation helpful? Give feedback.
Thanks guys, once again you are such great help. I’ve created the custom permissions and added the
admin
attribute to the controller and that worked perfectly.