Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.auth.php_session.PHPSessionAuth Class Reference
Inheritance diagram for MoinMoin.auth.php_session.PHPSessionAuth:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.auth.php_session.PHPSessionAuth:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def request
def login
def logout
def login_hint

Public Attributes

 s_path
 s_prefix
 apps
 autocreate

Static Public Attributes

string name = 'php_session'
list login_inputs = []
 logout_possible = False

Detailed Description

PHP session cookie authentication 

Definition at line 19 of file php_session.py.


Constructor & Destructor Documentation

def MoinMoin.auth.php_session.PHPSessionAuth.__init__ (   self,
  apps = ['egw'],
  s_path = "/tmp",
  s_prefix = "sess_",
  autocreate = False 
)
@param apps: A list of the enabled applications. See above for
    possible keys.
    @param s_path: The path where the PHP sessions are stored.
    @param s_prefix: The prefix of the session files.

Definition at line 24 of file php_session.py.

00024 
00025     def __init__(self, apps=['egw'], s_path="/tmp", s_prefix="sess_", autocreate=False):
00026         """ @param apps: A list of the enabled applications. See above for
00027             possible keys.
00028             @param s_path: The path where the PHP sessions are stored.
00029             @param s_prefix: The prefix of the session files.
00030         """
00031         BaseAuth.__init__(self)
00032         self.s_path = s_path
00033         self.s_prefix = s_prefix
00034         self.apps = apps
00035         self.autocreate = autocreate


Member Function Documentation

def MoinMoin.auth.BaseAuth.login (   self,
  request,
  user_obj,
  kw 
) [inherited]
def MoinMoin.auth.BaseAuth.login_hint (   self,
  request 
) [inherited]

Reimplemented in MoinMoin.auth.openidrp.OpenIDAuth, and MoinMoin.auth.MoinAuth.

Definition at line 213 of file __init__.py.

00213 
00214     def login_hint(self, request):
00215         return None

def MoinMoin.auth.BaseAuth.logout (   self,
  request,
  user_obj,
  kw 
) [inherited]

Reimplemented in MoinMoin.auth.cas.CASAuth, MoinMoin.auth.smb_mount.SMBMount, and MoinMoin.auth.log.AuthLog.

Definition at line 208 of file __init__.py.

00208 
00209     def logout(self, request, user_obj, **kw):
00210         if self.name and user_obj and user_obj.auth_method == self.name:
00211             logging.debug("%s: logout - invalidating user %r" % (self.name, user_obj.name))
00212             user_obj.valid = False
        return user_obj, True
def MoinMoin.auth.php_session.PHPSessionAuth.request (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 36 of file php_session.py.

00036 
00037     def request(self, request, user_obj, **kw):
00038         def handle_egroupware(session):
00039             """ Extracts name, fullname and email from the session. """
00040             username = session['egw_session']['session_lid'].split("@", 1)[0]
00041             known_accounts = session['egw_info_cache']['accounts']['cache']['account_data']
00042 
00043             # if the next line breaks, then the cache was not filled with the current
00044             # user information
00045             user_info = [value for key, value in known_accounts.items()
00046                          if value['account_lid'] == username][0]
00047             name = user_info.get('fullname', '')
00048             email = user_info.get('email', '')
00049 
00050             dec = lambda x: x and x.decode("iso-8859-1")
00051 
00052             return dec(username), dec(email), dec(name)
00053 
00054         cookie = kw.get('cookie')
00055         if not cookie is None:
00056             for cookiename in cookie:
00057                 cookievalue = urllib.unquote(cookie[cookiename].value).decode('iso-8859-1')
00058                 session = _PHPsessionParser.loadSession(cookievalue, path=self.s_path, prefix=self.s_prefix)
00059                 if session:
00060                     if "egw" in self.apps and session.get('egw_session', None):
00061                         username, email, name = handle_egroupware(session)
00062                         break
00063             else:
00064                 return user_obj, True
00065 
00066             u = user.User(request, name=username, auth_username=username,
00067                           auth_method=self.name)
00068 
00069             changed = False
00070             if name != u.aliasname:
00071                 u.aliasname = name
00072                 changed = True
00073             if email != u.email:
00074                 u.email = email
00075                 changed = True
00076 
00077             if u and self.autocreate:
00078                 u.create_or_update(changed)
00079             if u and u.valid:
00080                 return u, True # True to get other methods called, too
00081         return user_obj, True # continue with next method in auth list
00082 

Member Data Documentation

Definition at line 33 of file php_session.py.

Definition at line 34 of file php_session.py.

list MoinMoin.auth.BaseAuth.login_inputs = [] [static, inherited]
MoinMoin.auth.BaseAuth.logout_possible = False [static, inherited]
string MoinMoin.auth.php_session.PHPSessionAuth.name = 'php_session' [static]

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 22 of file php_session.py.

Definition at line 31 of file php_session.py.

Definition at line 32 of file php_session.py.


The documentation for this class was generated from the following file: