How to disable the Plone 5 toolbar for an authenticated user group?

Scenario below:

  • User is registered on my Plone 5 website.
  • A toolbar will appear, but they don’t have any options to do anything with it, because they are in an authenticated group.

They only get authenticated access to view multiple areas. How can I suppress a toolbar for specific user groups? or what is the best approach to this?

+4
source share
6 answers

The simplest approach would be to use CSS. You can provide conditional CSS that hides the toolbar:

#plone-toolbar-container {display: none}

: http://datakurre.pandala.org/2015/05/plonecustom-for-plone-5.html

: , .

+5

. Member ( , ), , ModifyPortalContent.

, Add, z3c.jbot.

  • toolbar.pt overrides . : plone/app/layout/viewlets/toolbar.pt. plone.app.layout.viewlets.toolbar.pt (. Plone docs).

  • .

    <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">
    

    <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">
    
  • CSS, Member.

    userrole-member.plone-toolbar-left-default { padding-left:0 }
    

/@@personal-preferences /logout, .

+4

:

, , body - plone-toolbar-left-default CSS, (.. ). , CSS , bodyClass plone_layout, CSS .

Plone , .

+2

Plone 5.1 (dev): CSS:

body.userrole-member #edit-zone {  
  display:none;
}
body.userrole-editor #edit-zone,
body.userrole-contributor #edit-zone,
body.userrole-reviewer #edit-zone {
  display:inline-block;
}

:

  • (body.userrole-editor.plone-toolbar-top-extended....)
  • ( : useractions)
+1

plone 5.1 " ".

rolemap.xml

Editor, Site admin, Manager ( ). , .

<?xml version="1.0"?>
<rolemap>
  <permissions>
    <permission name="Show Toolbar" acquire="False">
      <role name="Manager"/>
      <role name="Site Administrator"/>
      <role name="Editor"/>
    </permission>
  </permissions>
</rolemap>
0

, contentview plone-toolbar-main, .pt:

    <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="not: portal_state/anonymous"
     i18n:domain="plone">

....

<ul class="plone-toolbar-main">
      <div 
            tal:condition="python:checkPermission('Modify portal 
content',context)"
            tal:replace="structure view/base_render">
0

Source: https://habr.com/ru/post/1609321/


All Articles