gforcada
gforcada

Reputation: 2558

How to cleanly remove a Plone custom permission?

You know, you start creating a distribution called something.good and on it you define a permissions.zcml with something like:

<configure xmlns="http://namespaces.zope.org/zope">

  <permission
     id="something.good.reset"
     title="something.good: reset entries"
     />

</configure>

But then, once the distribution is installed on the server, you realize that the permission is not good enough and has to be completely refactored to something.else.

Uninstalling something.good from plone_quickinstaller does not remove the permission. Going to any security tab within ZMI you can still see it.

I looked around for documentation, browsing code in AccessControl and Products.GenericSetup but couldn't find anything.

Any idea on how to remove it?

Upvotes: 1

Views: 311

Answers (1)

gforcada
gforcada

Reputation: 2558

Ok, so Plone is easy, don't mind what others may tell you.

So, you (actually I) want to remove a permission definition? Just do it!

So the list of things to check to properly remove a permission are:

  • remove the permission from permissions.zcml
    • if there are no permissions left remove any reference to that file (maybe on your configure.zcml)
  • remove all references to the permission on profiles/default/rolemap.xml
  • scan all your configure.zcml or python files (if using grok-like permissions) to references to that permission

And that's it!

Once you restart your instance the permission will no longer show up on ZMI's Security tab.

Seems that permissions are created on-the-fly at startup time? Seems so to me. Prove me wrong though!

Upvotes: 1

Related Questions