SourceForge.net LogoPHPGallue
[ class tree: libgallue ] [ index: libgallue ] [ all elements ]

Class: GALUsers

Source Location: /libgallue/user.inc.php

Class Overview

GALTable
   |
   --GALGallueTable
      |
      --GALUsers

Manage users and handle database communication.


Methods


Inherited Variables

Inherited Methods

Class: GALGallueTable

GALGallueTable::__construct()
Initializes $glb object variable.
GALGallueTable::search()
SQL expression that searches for items containing $term.
GALGallueTable::visible()
SQL expression that is TRUE only for items visible to the user currently logged in.
GALGallueTable::writeable()
SQL expression that is TRUE only for items writeable by the user currently logged in.

Class: GALTable

GALTable::__construct()
Initializes this table.
GALTable::buildResult()
Implements the GALResultFactory interface.
GALTable::compareExpression()
Factory for GALExpressionCompare objects.
GALTable::containsKeyFields()
Checks if the specified fields contains a field that belongs to the primary key.
GALTable::count()
Count rows that match the given GALExpression.
GALTable::countFields()
Returns the number of fields contained in a result.
GALTable::delete()
Deletes the row identified by $key from the database.
GALTable::extendedCount()
Template for complex count queries.
GALTable::extendedLoad()
Template for complex queries.
GALTable::fullKey()
Checks if the specified fields in $keys are the full primary key.
GALTable::getFields()
Returns all fields contained in this result.
GALTable::getFlags()
Gets the flags of the given field.
GALTable::getIfRegistered()
Return the row with the submitted primary key values, if it has been registered before.
GALTable::getLength()
Gets the length of the given field.
GALTable::getName()
Returns this table's name.
GALTable::getParent()
Returns a reference to this table.
GALTable::getPrimaryKey()
Returns the primary key of this table.
GALTable::getResultFactory()
Returns the factory to construct results.
GALTable::getRowFactory()
Returns the factory to construct rows.
GALTable::getTable()
Gets the name of the table the given field is contained in.
GALTable::getType()
Gets the type of the given field.
GALTable::insert()
Inserts a row into this table.
GALTable::insertMultiple()
Inserts multiple rows into the database.
GALTable::isField()
Checks if the given field is contained in a result.
GALTable::load()
Load rows that match the given GALExpression.
GALTable::rawCount()
Counts rows from this table.
GALTable::rawLoad()
Loads rows from this table.
GALTable::register()
Registers the specified row or returns an already registered row.
GALTable::registered()
Checks if the specified row is already registered.
GALTable::row()
Fetches a row matching the given key from the database.
GALTable::setRegistered()
Set the entry in $rows specified by &$keys to the specified value.
GALTable::stripKeys()
Removes all fields from the submitted data which belong to the primary key.
GALTable::unregister()
Removes a registered row.
GALTable::updateRow()
Sets the fields of the specified row to the specified values.
GALTable::validFields()
Checks if all the field names submitted in $fields are valid.
GALTable::__destruct()
Destructs all rows stored in $rows.

Class Details

[line 39]
Manage users and handle database communication.

Only one instance of this class should exist for one database connection, i.e. one instance of GALGallery. This is assured inside __construct(). Most work is done by inherited methods from GALTable.




[ Top ]


Class Methods


constructor __construct [line 53]

GALUsers __construct( GALGallery $glb)

Initialize using GALGallery object.

This constructor shouldn't be called by a library user, the representations for the used tables are automatically created by the GALGallery object.

Check if an instance of GALUsers already exists in the specified GALGallery. If this is the case, throw a GAL_EUser If not, read necessary information for further initialization from $glb.




Tags:

see:  GALTable::_construct()


Overrides GALGallueTable::__construct() (Initializes $glb object variable.)

Parameters:

GALGallery   $glb   Necessary information for initialization.

[ Top ]

method add [line 122]

GALUser add( array $values, [bool $super = false])

Creates a new GALUser.

The parameter $values is an associative array with the following fields:

  • $value['name'] string required The user's full name.
  • $value['login'] string required The user's login name.
  • $value['email'] string optional The user's email address.
  • $value['homepage'] URL optional The user's homepage.
  • $value['password'] string optional The user's password. If not set the user cannot log in with a passowrd.
  • $value['quota'] int optional Not implemented yet. The space this user can consume. If not set, GAL_USER_DEFAULTQUOTA is used.
  • $value['rank'] int required The user's rank, one of GAL_RANK_LOCKED, GAL_RANK_GUEST, GAL_RANK_USER, GAL_RANK_AUTHOR, GAL_RANK_OPERATOR, GAL_RANK_ADMIN.
  • $value['settings'] string optional Not implemented yet. This suer's settings.




Tags:

return:  The newly created user.


Parameters:

array   $values   Array with data for user creation.
bool   $super   If true, override permission checks.

[ Top ]

method buildResult [line 76]

GALUserIterator buildResult( resource $result)

Creates iterator on mysql result resource.



Overrides GALTable::buildResult() (Implements the GALResultFactory interface.)

Parameters:

resource   $result  

[ Top ]

method keyLogin [line 241]

GALUser keyLogin( string $key)

Tries to log in an user with a login key.

This method queries GALLogins if the given key exists and is not outdated. If such a key exists, the corresponding user is logged in and the GALLogin::used property of the corresponding key is set to the current time.




Tags:

throws:  GAL_EUser If the identification fails.


Parameters:

string   $key   A login key.

[ Top ]

method login [line 184]

string login( string $login, string $password)

Tries to log in an user identified by $login and $password.

If login name and password match, GALGallery::user is set to the user with the specified login name and a login key is inserted into GALLogins using GALLogins::login(). This user can log in with this key using keyLogin() until the key expires.




Tags:

return:  The key insterted into GALLogins.
throws:  GAL_EUser If the user doesn't exist or the password is wrong.


Parameters:

string   $login   A login name.
string   $password   The password associated with the login name.

[ Top ]

method logout [line 268]

void logout( )

Log out the current user.

This method logs out the current user by calling it's logout() method and sets the current user to the default user.




[ Top ]

method noKeyCreateLogin [line 212]

GALUser noKeyCreateLogin( string $login, string $password)

Tries to log in an user identified by $login and $password for one request.

This method works similar to login(), but it doesn't create a login key.




Tags:

return:  The user that has been logged in.
throws:  GAL_EUser If the user doesn't exist or the password is wrong.


Parameters:

string   $login   A login name.
string   $password   The password associated with the login name.

[ Top ]

method search [line 66]

GALExpression search( string $term)

Search for an user.



Overrides GALGallueTable::search() (SQL expression that searches for items containing $term.)

Parameters:

string   $term   The search term.

[ Top ]

method visible [line 85]

GALExpression visible( )

SQL expression that is TRUE only for users visible to the user currently logged in.

Users are visible to all users except of locked users, but some fields like passwordMD5 are restricted (see GALUser).




Tags:

return:  A SQL logical expression that evaluates to TRUE for visible users.


Overrides GALGallueTable::visible() (SQL expression that is TRUE only for items visible to the user currently logged in.)

[ Top ]

method writeable [line 97]

GALExpression writeable( )

SQL expression that is TRUE only for users writeable by the user currently logged in.

An user with GAL_RANK_USER can only edit himself, an admin can edit any user.




Tags:

return:  A SQL logical expression that evaluates to TRUE for writeable users.


Overrides GALGallueTable::writeable() (SQL expression that is TRUE only for items writeable by the user currently logged in.)

[ Top ]


Documentation generated on Wed, 16 Aug 2006 15:36:52 +0200 by phpDocumentor 1.3.0RC6