view MoinMoin/auth/log.py @ 1364:582e7109a8c1

mass update - delete trailing spaces and/or add blank line to end of file
author Roger Haase <crosseyedpenguin@yahoo.com>
date Wed, 06 Jun 2012 15:03:07 -0700
parents f0d1cbe58e53
children 4ac437141bbe
line wrap: on
line source
# Copyright: 2006-2008 MoinMoin:ThomasWaldmann
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
    MoinMoin - logging auth plugin

    This does nothing except logging the auth parameters (the password is NOT
    logged, of course).
"""


from MoinMoin import log
logging = log.getLogger(__name__)

from MoinMoin.auth import BaseAuth, ContinueLogin

class AuthLog(BaseAuth):
    """ just log the call, do nothing else """
    name = "log"

    def __init__(self, **kw):
        super(AuthLog, self).__init__(**kw)

    def log(self, action, user_obj, kw):
        logging.info('{0}: user_obj={1!r} kw={2!r}'.format(action, user_obj, kw))

    def login(self, user_obj, **kw):
        self.log('login', user_obj, kw)
        return ContinueLogin(user_obj)

    def request(self, user_obj, **kw):
        self.log('session', user_obj, kw)
        return user_obj, True

    def logout(self, user_obj, **kw):
        self.log('logout', user_obj, kw)
        return user_obj, True