Elgg  Version 4.3
Public Member Functions | Protected Attributes | List of all members
Elgg\Database\UsersApiSessionsTable Class Reference

Manage the contents of the users_apisessions table. More...

Public Member Functions

 __construct (Database $database, Crypto $crypto)
 Create a new table handler. More...
 
 createToken (int $user_guid, int $expires=60)
 Obtain a token for a user. More...
 
 getUserTokens (int $user_guid)
 Get all tokens attached to a user. More...
 
 validateToken (string $token)
 Validate that a given token is still valid. More...
 
 removeToken (string $token)
 Remove user token. More...
 
 removeExpiresTokens ()
 Remove expired tokens. More...
 

Protected Attributes

 $database
 
 $crypto
 
 $table = 'users_apisessions'
 

Detailed Description

Manage the contents of the users_apisessions table.

Since
4.0

Definition at line 15 of file UsersApiSessionsTable.php.

Constructor & Destructor Documentation

Elgg\Database\UsersApiSessionsTable::__construct ( Database  $database,
Crypto  $crypto 
)

Create a new table handler.

Parameters
Database$databasethe Elgg database handler
Crypto$cryptocrypto handler

Definition at line 40 of file UsersApiSessionsTable.php.

Member Function Documentation

Elgg\Database\UsersApiSessionsTable::createToken ( int  $user_guid,
int  $expires = 60 
)

Obtain a token for a user.

Parameters
int$user_guidthe user guid
int$expiresminutes until token expires (default is 60 minutes)
Returns
false|string

Definition at line 53 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::getUserTokens ( int  $user_guid)

Get all tokens attached to a user.

Parameters
int$user_guidThe user GUID
Returns
false|[]

Definition at line 78 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::removeExpiresTokens ( )

Remove expired tokens.

Returns
int Number of rows removed

Definition at line 126 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::removeToken ( string  $token)

Remove user token.

Parameters
string$tokenThe token
Returns
bool

Definition at line 114 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::validateToken ( string  $token)

Validate that a given token is still valid.

Parameters
string$tokenthe token to verify
Returns
false|int the user guid attached to the token, or false

Definition at line 93 of file UsersApiSessionsTable.php.

Member Data Documentation

Elgg\Database\UsersApiSessionsTable::$crypto
protected

Definition at line 27 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::$database
protected

Definition at line 22 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::$table = 'users_apisessions'
protected

Definition at line 32 of file UsersApiSessionsTable.php.


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