Hanno Schlichting wrote:
Takahashi, Mike wrote:
I am working on a product that will add extra local roles managed in the
@@sharing view in Plone (sharing tab).

I've added the necessary code into configure.zcml and localroles.py of
my product.  However, when I place my product within the /Products
directory the new local roles appear within the sharing tab of existing
and newly created Plone instances, even though my Product has never been
installed. I would like to be able to only have these roles apply when
the Product is installed. Any help is greatly appreciated!

There are two parts here:

- The actual roles (of which the default are things like Manager, Member, Reviewer, Editor, Creator and Viewer)

- The switch that tells the @@sharing view to show a given role (which is implemented as a local utility)

The former is "local" in Zope, i.e. it's only installed into a particular site, e.g. using rolemap.xml.

The latter is "global" if registered with ZCML, as Hanno points out. However, if there is no corresponding role in a given Plone site, the "extra" global utility should have no effect.

Configuration in ZCML will be executed at Zope startup and is inherently global. Utilities defined in ZCML will be registered with the global site manager.

You can try to move the utility registrations to a GenericSetup extension profile into a componentregistry.xml file. When you install that profile into a specific Plone site, the utilities will be added to the local persistent site manager in the Plone site root, thus making them local to the instance.

I'm not 100% certain that this works but see no specific reason why it shouldn't work. After all these are just normal utilities.

I'm pretty sure this will work; it's how we intended to make the available local roles editable through a control panel - we just never got there.

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to