Problem:
We want to perform actions when a user is added to a group, and possibly when a user is removed from a group. There is no hook point for this currently in the zope.app.authentication code.


Solution:
Fire events in the zope.app.authentication code when principals are added and removed from groups.

----8<----8<----
from zope import interface

def IPrincipalAddedToGroup(interface.Inteface):
group = interface.Attribute('the group to which the principal was added')
    principal = interface.Attribute('the principal added')

def IPrincipalRemovedFromGroup(interface.Inteface):
group = interface.Attribute('the group from which the principal was removed')
    principal = interface.Attribute('the principal removed')

----8<----8<----

In terms of implementation, it looks like zope.app.authentication.groupfolder.GroupFolder._addPrincipalToGroup and zope.app.authentication.groupfolder.GroupFolder._removePrincipalFromGrou p are the methods that would fire the events.

Risks:
I am aware of None.

Thoughts?
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to