[Zope3-dev] Mini-proposal: zope.app.authentication group events

Gary Poster gary at zope.com
Thu Jan 12 14:11:26 EST 2006


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?


More information about the Zope3-dev mailing list