Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plone: Add permission to role

In a Plone site there is a permission called "access inactive portal content". By default, this is granted to the roles "Manager" and "Owner".

I want to grant this permission to the role "Editor" as well, and I know I can just use the corresponding checkbox in the "Security" tab in the ZMI, but I'd like to do it programmatically in some sort of setup script. How would I do that?

like image 491
Johannes Charra Avatar asked Aug 31 '11 11:08

Johannes Charra


1 Answers

you have to create a new product and add a genericsetup step called "rolemap.xml" with this:

<?xml version="1.0"?>
<rolemap>
  <permissions>
    <permission name="Access inactive portal content" acquire="False">
      <role name="Editor" />
    </permission>
  </permissions>
</rolemap>

More info:

  • http://plone.org/documentation/kb/genericsetup
  • http://plone.org/documentation/manual/developer-manual/generic-setup/reference/roles-and-permissions

Bye, Giacomo

like image 59
Giacomo Spettoli Avatar answered Sep 23 '22 09:09

Giacomo Spettoli