General developer forum

Hiding some items from the edit dropdown

Picture of Lea Cohen
Hiding some items from the edit dropdown
I asked this on the Roles and permissions forum but didn't get a response, So I thought I might ask it here, adding a few details that belong here rather than there

We have a course in which we would like to enable participants to add activities and resources to a sharing cart (using the sharing cart plugin).

In order to do that, we have to give them editing rights, since the Copy to Sharing Cart option is an item in the editing dropdown:

editor with full menu

However, that enables them to edit, delete, show & hide, and other actions, on those activities, which we don't want. We only want them to be see the Copy to Sharing Cart item:

editor with only cart item in menu

We're willing to create a new role for that, but we can't find the correct permissions to give that role in order for that to happen.

I did find a way to get around this, using CSS, but it seems to me hacky and I prefer a more "formal" way. We created a role called Sharing Teacher which is a copy of the Teacher role. I give the body a class based on the user role, and then hide the edit menu items - other than the sharing cart -from users with that role via CSS.

.courserole-sharing_cart_teacher .commands .dropdown-item:not(.editing_backup) {
    display: none;

Are we missing something? Is there a way to do this using permissions or code, or is permissions by editing item too granular ?
Average of ratings: -