Elgg  Version 5.1
Public Member Functions | Public Attributes | 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...
 

Public Attributes

const TABLE_NAME = 'users_apisessions'
 

Protected Attributes

Database $database
 
Crypto $crypto
 

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 34 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 47 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 68 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::removeExpiresTokens ( )

Remove expired tokens.

Returns
int Number of rows removed

Definition at line 113 of file UsersApiSessionsTable.php.

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

Remove user token.

Parameters
string$tokenThe token
Returns
bool

Definition at line 101 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 83 of file UsersApiSessionsTable.php.

Member Data Documentation

Crypto Elgg\Database\UsersApiSessionsTable::$crypto
protected

Definition at line 26 of file UsersApiSessionsTable.php.

Database Elgg\Database\UsersApiSessionsTable::$database
protected

Definition at line 24 of file UsersApiSessionsTable.php.

const Elgg\Database\UsersApiSessionsTable::TABLE_NAME = 'users_apisessions'

Definition at line 22 of file UsersApiSessionsTable.php.


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