[Zope3-checkins] CVS: Zope3/src/zope/app/security - principallogging.py:1.1 configure.zcml:1.5

Viktorija Zaksiene ryzaja@codeworks.lt
Tue, 22 Jul 2003 11:10:10 -0400


Update of /cvs-repository/Zope3/src/zope/app/security
In directory cvs.zope.org:/tmp/cvs-serv14056/src/zope/app/security

Modified Files:
	configure.zcml 
Added Files:
	principallogging.py 
Log Message:
Vika and Bjorn Tillenius:
Made HTTPRequest.setUser use an adapter to choose what name to log. We don't want to
make policy decisions there.


=== Added File Zope3/src/zope/app/security/principallogging.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""An adapter from IPrincipal to the ILoggingInfo.

$Id: principallogging.py,v 1.1 2003/07/22 15:09:35 ryzaja Exp $
"""

from zope.interface import implements
from zope.publisher.interfaces.logginginfo import ILoggingInfo

class PrincipalLogging:

    implements(ILoggingInfo)

    def __init__(self, principal):
        self.principal = principal

    def getLogMessage(self):
        return str(self.principal.getId())


=== Zope3/src/zope/app/security/configure.zcml 1.4 => 1.5 ===
--- Zope3/src/zope/app/security/configure.zcml:1.4	Mon Feb  3 10:08:44 2003
+++ Zope3/src/zope/app/security/configure.zcml	Tue Jul 22 11:09:35 2003
@@ -56,5 +56,9 @@
            provides="zope.app.interfaces.security.ILoginPassword"
            for="zope.publisher.interfaces.ftp.IFTPCredentials" />
 
+  <adapter factory="zope.app.security.principallogging.PrincipalLogging"
+           provides="zope.publisher.interfaces.logginginfo.ILoggingInfo"
+           for="zope.app.interfaces.security.IPrincipal" />
+
 </zopeConfigure>