[ASK] Adding Menu Item in Sidebar

Re: [ASK] Adding Menu Item in Sidebar

by Alexander Bias -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Johan,

short answer: Restricting custom nodes to a certain role is currently not possible with our plugin and probably won't be possible forever.

Longer answer: We had the need to restrict custom nodes to subsets of users in our own production system. And we saw that there are several things available as a criteria for showing a node to a user or not: cohort memberships, roles, capabilities, user profile field values were the most important ones.

We decided to go with cohort memberships as they are globally usable in Moodle and as we have a nice plugin on https://moodle.org/plugins/local_profilecohort to fill cohorts based on user profile fields. If you can group your users into cohorts to show custom nodes (or not), this is the solution for you.

We also thought about using roles instead of cohorts. But historically, roles are not intended to be used to decide about allowing or denying anything in Moodle, it's the role's capabilities which should be used. We have build a plugin before on https://moodle.org/plugins/availability_role which lets you decide based on roles if an activity is available or not. It was quite awful to respect all role aspects like role inheritance, role switches or role overrides and we didn't want to redo that.

Thanks,
Alex