Scenario below:
They only get Authenticated access to view a few areas. How can I suppress the toolbar for certain user groups? or what is the best approach to this?
The simplest approach will be using CSS. You can provide a conditional CSS that hide the toolbar:
#plone-toolbar-container {display: none}
A very simple approach for this is described in this article: http://datakurre.pandala.org/2015/05/plonecustom-for-plone-5.html
Please note: the toolbar contains also a section to personal preference, so removing it will also hide some user's features.
A nice way is to use roles and permissions. You can hide the toolbar for the Member
role only (and not Editor, Reviewer and Manager) by overriding the toolbar and defining your own condition that filters on the ModifyPortalContent
permission.
Here is an example for when you are developing your own Add on that depends on z3c.jbot.
Put a copy of the toolbar.pt
template in the overrides
directory of your Add on. This is the path to the template: plone/app/layout/viewlets/toolbar.pt
. Rename the new file to plone.app.layout.viewlets.toolbar.pt
for it to work (see plone docs).
Customise the main condition in the template.
<section id="edit-bar" role="toolbar"
tal:define="portal_state view/portal_state;
personal_bar python: view.get_personal_bar()"
tal:condition="not: portal_state/anonymous"
i18n:domain="plone">
becomes
<section id="edit-bar" role="toolbar"
tal:define="portal_state view/portal_state;
personal_bar python: view.get_personal_bar();
checkPermission nocall: context/portal_membership/checkPermission"
tal:condition="python:checkPermission('Modify portal content',context)"
i18n:domain="plone">
Add some CSS to remove the padding on the body for the Member role only.
userrole-member.plone-toolbar-left-default { padding-left:0 }
Now supply some new links for the user to /@@personal-preferences
and /logout
and you're done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With