Packageindex Classtrees Modulegroups Elementlist Report XML Files

pxdb.auth

pxdb_user

pxdb_data
   |
  +-- pxdb_record
     |
    +-- pxdb_user

private class pxdb_user extends pxdb_record

This class exposes an API that supports the core methods of the AuthDB class, written by Nyk Cowham for Forum One Communications, and licensed under the GPL. This class extends the pxdb_record class and provides some authentication-specific functionality. This class is organized so that you can override the methods: sql_groups() -- get group ids and names for current user sql_user() -- get username sql_uid() -- get user id

AuthorsHans Lellelid <hans@velum.net>
Version$Revision: 1.10 $

 

Methods inherited from pxdb_record

pxdb_record, get_id, set_id, &get_related, set_show_unapproved, get_related_values, &get_secondaryrel_related, get_secondaryrel_related_values, &get_children_noderelid, &get_children, get_children_values, &get_parents, get_parents_values, get_field_strict, &get_field, has_field, get_all_privs, get_user_privs, get_group_privs, get_global_privs, is_authorized

Methods inherited from pxdb_data

pxdb_data, set_show_unapproved, get_datatype, get_datatype_list, get_datatype_array, set_datatype, bind_tpl, bind_auth, lookup_colname, lookup_tfid, get_column_identifiers, get_identifiers, set_user_minimal_columns, sql_minimal_columns, sql_aliased_columns

Public Method Summary

void pxdb_user([ int $id ])
Constructor.
object pxdb_user &singleton([ int $id, boolean $instantiate_new, boolean $destroy ])
Attempts to return a reference to an already-instantiated user class.
void destroy()
Destroys the current singleton, if set.
void set_username_col(string $col)
Set the column name to use for the username.
void add_admin_group(mixed $group)
Adds an admin group to the admin_gidarray array.
boolean read()
Read in data from db.Warning: documentation is missing.
string sql_groups()
The SQL that gets the groups for this user.
string get_user()
Returns the current username.
int get_uid()
[Legacy] Provides an alias to get_id()
boolean is_admin()
A Public boolean test method - see documentation
boolean not_admin()
A Public boolean test method - see documentation
boolean is_member(mixed $group, [ string $behavior ])
Returns whether user is member of passed group [id].
boolean not_member(string $group)
Returns true if user is not in passed group [name].
void get_groups()
Sets the ugidarray and grouparray with values for current user.
void build_sql()
A Public accessor method - see documentation
string get_sql_groups()
A Public accessor method - see documentation
string get_sql_ugids()
A Public accessor method - see documentation
integer set_default_ugid(int $ugid)
Set Default UserGroup ID
integer get_default_ugid()
Get Default User Group ID
integer set_default_groupname(string $groupname)
Set Default Group Name
string get_default_groupname()
Get Default Group Name
array get_group_array()
Public method for getting group array
array get_ugid_array()
Public method for getting ugid array

Private Method Summary

object pxdb_user &existant()
Will return an object if already instantiated.

Fields inherited from pxdb_record

$fields, $record_id

Fields inherited from pxdb_data

$debug, $errors, $datatype, $auth, $tpl, $show_unapproved, $user_minimal_columns

Public Field Summary

array $ugidarray
Array of user/group ids that user belongs to.
array $grouparray
Array of group names.
object [unknown] $db
ADOdb Connection.

Private Field Summary

integer $default_ugid

string $default_groupname

string $username_col

string $user
Username.
string $encrypted_user
The encrypted username.
string $sql_encryption_function
DB function for encryption.
string $groups
The SQL-ready list of groups (based on grouparray above).
string $ugids
The SQL-ready list of user and group IDs (based on $ugidarray above)
array $admin_gids
Array of admin groups.
unknown $this

Public Method Details

pxdb_user

public void pxdb_user([ int $id ])

 

Parameter
int $id = >>null<<
UserID for user record.
Returns void


&singleton

public object pxdb_user &singleton([ int $id, boolean $instantiate_new, boolean $destroy ])

  Will create a new user class only if one does not already exist for current db.

Parameter
int $id = >>null<<
The UserID to instantiate.
boolean $instantiate_new = >>true<<
Whether to create a new instance if one doesn't exist (default: true)
boolean $destroy = >>false<<
Whether to destroy the current singleton.
Returns object pxdb_user

or NULL if it's being destroyed.


destroy

public void destroy()

 

Returns void

Since 0.0.4

set_username_col

public void set_username_col(string $col)

 

Parameter
string $col
The column name.
Returns void


add_admin_group

public void add_admin_group(mixed $group)

 

Parameter
mixed $group
name or id to add to array.
Returns void


read

public boolean read()

 

Warning: documentation is missing.

Returns boolean

True /false on success.


sql_groups

public string sql_groups()

  This method can be overridden by child classes that wish to redefine the relationshps between users and groups -- e.g. to have all group-user relationships be defined on a per-project basis.

Returns string

SQL used to fetch group ids and names for given user.


get_user

public string get_user()

 

Returns string

Username


get_uid

public int get_uid()

 

Returns int

id


is_admin

public boolean is_admin()

 

Returns boolean


not_admin

public boolean not_admin()

 

Returns boolean


is_member

public boolean is_member(mixed $group, [ string $behavior ])

 

Parameter
mixed $group
The group id (or name) OR array of these that we are checking against.
string $behavior = >>'any'<<
'any' or 'all' -- how the membership is treated -- i.e. does user have to be in any of groups specified, or all?
Returns boolean $group

Whether is in $grouparray.


not_member

public boolean not_member(string $group)

 

Parameter
string $group
The group name to check.
Returns boolean $group

Whether is not in $grouparray.


get_groups

public void get_groups()

 

Returns void


build_sql

public void build_sql()

  Although you can invoke this explicitly, most of the time you are probably better off letting it be implicitly invoked from get_sql_groups() or get_sql_ugids()

Returns void


get_sql_groups

public string get_sql_groups()

 

Returns string

List of group names.


get_sql_ugids

public string get_sql_ugids()

 

Returns string

List of user-group IDs.


set_default_ugid

public integer set_default_ugid(int $ugid)

  Set the default UserGroup ID in case you use something different than 0 as your default group ID.

Parameter
int $ugid
The default User Group ID
Returns integer

0 if no value passed


get_default_ugid

public integer get_default_ugid()

  Get the currently set default usergroup ID. See set method above.

Returns integer

The ID of the current default group


set_default_groupname

public integer set_default_groupname(string $groupname)

  Set the default group name to something other than 'Everybody' if your project has something different.

Parameter
string $groupname
name of the default group
Returns integer

0 if no value passed


get_default_groupname

public string get_default_groupname()

  Gets the currently set name for the default group

Returns string

The current default group name


get_group_array

public array get_group_array()

  Added by OAM

Returns array


get_ugid_array

public array get_ugid_array()

  Added by OAM

Returns array


Private Method Details

&existant

private object pxdb_user &existant()

  This method calls singleton with a FALSE second parameter. Both singleton and this method need to use one method for the static variable to work.

Returns object pxdb_user


Public Field Details

$ugidarray

public array $ugidarray

>>array()<<


$grouparray

public array $grouparray

>>array()<<


$db

public object [unknown] $db

>><<


Private Field Details

$default_ugid

private integer $default_ugid

>><<


$default_groupname

private string $default_groupname

>>'Everybody'<<


$username_col

private string $username_col

>>'idnum'<<


$user

private string $user

>><<


$encrypted_user

private string $encrypted_user

>><<


$sql_encryption_function

private string $sql_encryption_function

>>'MD5'<<


$groups

private string $groups

>><<


$ugids

private string $ugids

>><<


$admin_gids

private array $admin_gids

>><<


$this

private unknown $this

>><<



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