Attachment 'DummyAuth.py'

Download

   1 # Dummy auth for MoinMoin.
   2 # Usage: add these lines to your wikiconfig.py:
   3 #
   4 #   from DummyAuth import DummyAuth
   5 #   auth = [DummyAuth(u'JaneDoe')] 
   6 
   7 from MoinMoin import user
   8 from MoinMoin.auth import BaseAuth, ContinueLogin
   9 
  10 class DummyAuth(BaseAuth):
  11     """Just always logs in the user specified in auth_dummy_username."""
  12 
  13     name = 'dummy'
  14     logout_possible = False
  15     login_inputs = []
  16     
  17     def __init__(self, username=u'JaneDoe'):
  18         self.username = username
  19 
  20     def request(self, request, user_obj, **kw):
  21         u = user.User(request, name=self.username, auth_method=self.name,
  22                       auth_attribs=('name',))
  23         u.valid = True
  24         u.create_or_update(True)
  25         return u, True
  26 #        return ContinueLogin(u)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-12-12 18:20:59, 2.8 KB) [[attachment:Auth_nis_login.py]]
  • [get | view] (2009-01-28 22:58:20, 0.7 KB) [[attachment:DummyAuth.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.