view MoinMoin/auth/log.py @ 2025:d919b7b7b3e9

auth framework: login() methods return an object now This avoids overloading the returned tuple and simplifies code since they can now just instantiate ContinueLogin(), CancelLogin() etc.
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 24 Apr 2007 12:04:19 +0200
parents 1b14cc05a54a
children 40c4670c3410
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - logging auth plugin

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

    @copyright: 2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.auth import BaseAuth, ContinueLogin

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

    def log(self, request, action, user_obj, kw):
        request.log('auth.log: %s: user_obj=%r kw=%r' % (action, user_obj, kw))

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

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

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