ploneplone-3.x

Subscriber when a group is assigned to an user


When assigning a user to a group, is it possible to call a subscriber? Are there available events to this action? If so, in which product?


Solution

  • No. It does not appear that Products.PluggableAuthService.plugins.ZODBGroupManager.ZODBGroupManager.addPrincipalToGroup nor anything that calls it notifies any event.

    I would suggest that if you have an add-on that needs this:

    (1) Submit a feature request ticket at https://dev.plone.org -- it would be nice to have this, I am pretty sure that I could use it too.

    (2) For now, have your add-on monkey patch ZODBGroupManager.addPrincipalToGroup() method wrapping the original function with an event notification of your own devising called after the user is added to the group. https://stackoverflow.com/search?q=monkey+patch+python