Packageindex Classtrees Modulegroups Elementlist Report XML Files

pxdb.auth

pxdb_auth

pxdb_auth

public class pxdb_auth

AuthorsHans Lellelid <hans@velum.net>

 

Public Method Summary

void pxdb_auth([ string $auth_key ])
Constructor.
object pxdb_auth &singleton([ string $auth_key ])
Attempts to return a reference to an already-instantiated auth class.
void import([ array $source ])
Performs the basic task of loading data into the $_imported var.
void allow(string $page)
Allows a page to pass through the auth pipeline w/o authenticating.
boolean is_allowed([ string $page ])
Determines whether a page is allowed to pass through the authentication pipeline without authenticating.
mixed set_username_field(string $field)
Set the column to use for username.
mixed set_password_field(string $field)
Sets the records field to use for password.
mixed &authenticate()
Authenticate a user.
void restrict(mixed $groups)
Restrict access to members of certain groups.
object A &user(mixed $user, [ string $sql_enc_func ])
Gets a new pxdb_user object with the given username or userid.
void set_datatypes(string $dt)
Overrides the default login datatypes (usualy 1 = user)
mixed &login()
Check login information against database.
void logout()
Clears a user login.
void showlogin([ string $template, array $additional_vars ])
Display login form.

Private Method Summary

void preserve_vars()
Preserve POST and GET variables which will be un-packed after login process is finished.

Private Field Summary

string $username_col
The username column.
string $password_col
The password column.
array $datatype

string $message
Stores message displayed on login form.
array $restrict_groups
The groups that user must be a member of in order to be authorized for this page.
array $open_pages
Pages that do not need to pass authentication.
string $auth_key
The unique key/name for this auth session.
string $tpl
Template to use for login form.
unknown $preserved_get_vars
For preserving GET vars after authentication
unknown $preserved_post_vars
For preserving POST vars after authentication

Public Method Details

pxdb_auth

public void pxdb_auth([ string $auth_key ])

 

Parameter
string $auth_key = >>'auth'<<
A unique identifier to use for this authentication / session.
Returns void


&singleton

public object pxdb_auth &singleton([ string $auth_key ])

  Will create a new auth class only if one does not already exist.

Parameter
string $auth_key = >>'auth'<<
A unique identifier to use for this authentication / session.
Returns object pxdb_auth


import

public void import([ array $source ])

  Sub-classes that override this method should always provide this minimal function signature and should begin by invoke the parent import() method.

Parameter
array $source = >>null<<
The source values to import.
Returns void


allow

public void allow(string $page)

  This is important if you have some pages that should be visible to an un-authenticated user Some examples might include: - an overview / landing (not login) page - a "forgot my password" page.

Parameter
string $page
Relative URL to match for pages that are allowed through.
Returns void


is_allowed

public boolean is_allowed([ string $page ])

  By default (if no page is specified), it will check to see if $_SERVER[PHP_SELF] is in the $open_pages array.

Parameter
string $page = >>null<<
The page we are checking for.
Returns boolean


set_username_field

public mixed set_username_field(string $field)

  Looks up the column name corresponding to passed identifer or fname.

Parameter
string $field
The identifer/fname/id of field to use for username.
Returns mixed


set_password_field

public mixed set_password_field(string $field)

  Looks up the column name corresponding to passed identifer or fname.

Parameter
string $field
The identifer/fname/id of field to use for username.
Returns mixed


&authenticate

public mixed &authenticate()

  This function uses PHP 4 sessions to store hash based on logged-in user. This function will try 1) to find an existing session 2) to login based on entered_username and entered_password in the $_imported array. After user is logged-in, this function will ensure that they have privs necessary to view current page, and then it will unpack the preserved GET & POST vars.

Returns mixed

A new pxdb_user object or false if they are not logged in.


restrict

public void restrict(mixed $groups)

  Sets the $restrict_groups attribute to the array of group names.

Parameter
mixed $groups
An array or delimited string of group *names*
Returns void


&user

public object A &user(mixed $user, [ string $sql_enc_func ])

 

Parameter
mixed $user
The username or ID of user to log in.
string $sql_enc_func = >>null<<
The SQL encryption function to use to test the passed value. (e.g. 'MD5') This is used by the authenticate() method, since values are stored in the session encrypted with MD5.
Returns object A

new pxdb_user object.


set_datatypes

public void set_datatypes(string $dt)

 

Parameter
string $dt
seperated ids
Returns void


&login

public mixed &login()

 

Returns mixed

The pxdb_user object or false if not able to authenticate user.


logout

public void logout()

  Deletes the session variable and destroys (as of 0.0.4) the pxdb_user singleton.

Returns void


showlogin

public void showlogin([ string $template, array $additional_vars ])

  This method outputs the processed template to the buffer.

Parameter
string $template = >>null<<
Template path for login form.
array $additional_vars = >>null<<
Hash of additional vars that should be set for the template to use.
Returns void


Private Method Details

preserve_vars

private void preserve_vars()

  This enables the user to resume exactly where they left off if their session expires.

Returns void


Private Field Details

$username_col

private string $username_col

>>'idnum'<<


$password_col

private string $password_col

>>'password'<<


$datatype

private array $datatype

>><<


$message

private string $message

>>''<<


$restrict_groups

private array $restrict_groups

>>array()<<


$open_pages

private array $open_pages

>>array()<<


$auth_key

private string $auth_key

>><<


$tpl

private string $tpl

>><<


$preserved_get_vars

private unknown $preserved_get_vars

>><<


$preserved_post_vars

private unknown $preserved_post_vars

>><<



Packageindex Classtrees Modulegroups Elementlist Report XML Files
Generated on Fri, 28 Apr 2006 19:07:22 -0400 by PHPDoc v1.5 www.phpdoc.de