[Zope3-dev] principal events for the event hub

Christian Heimes heimes@faho.rwth-aachen.de
Fri, 11 Apr 2003 15:27:52 +0200


While trying to solve a problem I discovered that there are no events 
pertaining to principals. You can't monitor the event hub for a 
principal login to take actions when he/she is logged in.

zope/app/interfaces/event.py:

class IPrincipalEvent(IEvent):
     """Something happens to a principal"""

class IPrincipalAuthorizedEvent(IPrincipalEvent):
     """Something happens to an authorized principal"""
     principal = Attribute("principal object")
     authSource = Attribute("the principal authorization source which 
has authorized the principal")

class IPrincipalUnauthorizedEvent(IPrincipalEvent):
     """Something happens to an unauthorized principal"""

class IPrincipalAccessEvent(IPrincipalEvent):
     """A principal tries to access an object"""
     location = Attribute("location of the object")

class IPrincipalUnauthorizedAccesEvent(IPrincipalUnauthorizedEvent, 
IPrincipalAccessEvent):
     """Unauthorized access to an object"""

class IPrincipalAuthorizedAccesEvent(IPrincipalAuthorizedEvent, 
IPrincipalAccessEvent):
     """Authorized access to an object"""

class IPrincipalLoginEvent(IPrincipalAuthorizedEvent):
     """A principal has logged in"""

class IPrincipalLogoutEvent(IPrincipalAuthorizedEvent):
     """A principal has logged out"""

class IPrincipalLoginFailureEvent(IPrincipalUnauthorizedEvent):
     """A principal missed to log in"""


Request for comments please :)

Christian aka Tiran on #zope3-dev