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

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

Public Member Functions

 __construct (protected Database $database, protected 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'
 

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 ( protected Database  $database,
protected Crypto  $crypto 
)

Create a new table handler.

Parameters
Database$databasethe Elgg database handler
Crypto$cryptocrypto handler

Definition at line 30 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 41 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 62 of file UsersApiSessionsTable.php.

Elgg\Database\UsersApiSessionsTable::removeExpiresTokens ( )

Remove expired tokens.

Returns
int Number of rows removed

Definition at line 107 of file UsersApiSessionsTable.php.

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

Remove user token.

Parameters
string$tokenThe token
Returns
bool

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

Member Data Documentation

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: