Documenting a quirk of Plone (Classic UI) toolbar visibility here:
- In Plone 5.0+, the
@@plone
view'sshowToolbar
method checks user for any of three permissions (toolbar contents shown if any of these, otherwise additional logic below applies):
a.Modify portal content
b.Add portal content
c.Review portal content
- In ~2017, a
Show Toolbar
permisssion was added toplone.app.layout
presumably for purposes of hiding toolbar.- but it is critical to note that this is not itself sufficient to show the toolbar's contents — you can end up with an empty toolbar, despite having this permission.
- As it ships now (6.1),
@@plone
view logic will not show toolbar if you do not have non-View actions in the top-level of the toolbar (that is, any action not namedview
intabSet1
oftabSet2
), even if you have perfectly useful and relevant content menus to display in the toolbar.- is it reasonable to assume that if a non-empty menu is visible to user, the toolbar at large should be displayed?
- My use case is a user:
a. with permission to view content in a particular state
b. without permission toModify portal content
in that state
c. but a permission to see and execute aretract
transition from that state from the workflow menu
d. and for which the only top-level action isview
, but ideally should get a content menu if that menu is applicable. - My plan for my integration case is to subclass and override
@@plone
view to wrap OOTB method with logic to handle this case (non-empty menu).- although it would be nice if there was some consensus for what this looks like in the general case; it would probably require both
True
return value forplone.app.contentmenu.menu.WorkflowSubMenuItem.available
and a non-empty return value forplone.app.contentmenu.menu.WorkflowSubMenuItem._transitions
to consider non-empty. For all other menus shipped inplone.app.contentmenu
theavailable()
method is a sufficient check on visibility for determination of whole-toolbar visibility, in my opinion.
- although it would be nice if there was some consensus for what this looks like in the general case; it would probably require both