Documentation

Auth
in package

Table of Contents

Properties

$db  : MySql
$enc  : Encryption
$request  : Request
$role  : string
$session  : Session

Methods

__construct()  : mixed
cleanAuthTable()  : void
Deletes redundant validator tokens
createUser()  : array<string|int, mixed>
Creates user
getUserRoles()  : array<string|int, mixed>
Returns array with user's roles
hasRole()  : bool
Returns boolean indicating whether a use has particular role
logIn()  : bool
Logs in a user
logOut()  : bool
Logs out the user
isAuth()  : bool|int
Checks whether the user is logged On success, SESSION is always closed for performance reasons
resetPasword()  : bool
cookieAuthRow()  : array<string|int, mixed>|null
Returns id and user_id from auth_user identified using COOKIE data
cookieDomain()  : string
Returns the domain to be used for setcookie function
generateToken()  : string
Generates validator token
storageName()  : string
SESSION/COOKIE storage name
updateLastLogin()  : void
Updates user last login time

Properties

$role

protected string $role = ''

Methods

cleanAuthTable()

Deletes redundant validator tokens

public cleanAuthTable(int $userId) : void
Parameters
$userId : int

createUser()

Creates user

public createUser(string $firstName, string $lastName, string $username, string $pwd[, int $status = 1 ]) : array<string|int, mixed>
Parameters
$firstName : string
$lastName : string
$username : string
$pwd : string
$status : int = 1
Return values
array<string|int, mixed>

getUserRoles()

Returns array with user's roles

public getUserRoles(int $userId) : array<string|int, mixed>
Parameters
$userId : int
Return values
array<string|int, mixed>

hasRole()

Returns boolean indicating whether a use has particular role

public hasRole(int $userId, string $role) : bool
Parameters
$userId : int
$role : string
Return values
bool

logIn()

Logs in a user

public logIn(string $username, string $pwd[, bool $remember = false ]) : bool
Parameters
$username : string
$pwd : string
$remember : bool = false
Return values
bool

logOut()

Logs out the user

public logOut() : bool
Return values
bool

isAuth()

Checks whether the user is logged On success, SESSION is always closed for performance reasons

protected isAuth() : bool|int
Return values
bool|int

resetPasword()

protected resetPasword(int $userId, string $pwd[, bool $login = false ]) : bool
Parameters
$userId : int
$pwd : string
$login : bool = false
Return values
bool

cookieAuthRow()

Returns id and user_id from auth_user identified using COOKIE data

private cookieAuthRow(string $storageName) : array<string|int, mixed>|null
Parameters
$storageName : string
Return values
array<string|int, mixed>|null

cookieDomain()

Returns the domain to be used for setcookie function

private cookieDomain() : string
Return values
string

generateToken()

Generates validator token

private generateToken() : string
Return values
string

storageName()

SESSION/COOKIE storage name

private storageName() : string
Return values
string

updateLastLogin()

Updates user last login time

private updateLastLogin(int $userId) : void
Parameters
$userId : int

        
On this page

Search results