Documentation

Login extends BaseAction
in package
Uses LoginHistory

Webservice standard container - Users Login action class.

Table of Contents

DATE_TIME_FORMAT  = 'Y-m-d H:i:s'
$allowedHeaders  : array<string|int, mixed>
$allowedMethod  : array<string|int, string>
$controller  : Controller
$responseType  : string
$userData  : array<string|int, mixed>
checkAction()  : void
Check called action.
getLanguage()  : string
Get current language.
getParentCrmId()  : int|null
Get parent record.
getPermissionType()  : int
Get permission type.
getUserCrmId()  : int
Get crmid for portal user.
getUserData()  : mixed
Get user data and session data.
getUserStorageId()  : int
Get user storage ID.
post()  : array<string|int, mixed>|null
Post method.
preProcess()  : mixed
Pre process function.
setAllUserData()  : void
Set user data.
setUserData()  : void
Set user data.
updateSession()  : void
Update user session.
updateUser()  : void
Update user data.
checkAccess()  : void
Check access data.
checkLifetimeSession()  : void
Check lifetime user session.
checkPermission()  : void
Check permission to method.
checkPermissionToModule()  : void
Check permission to module.
createSession()  : void
Update user session.
loadSession()  : void
Load user session data .
returnData()  : array<string|int, mixed>
Build data for api response.
saveData()  : void
Save user data and logs.
saveLoginHistory()  : void
Function to store the login history.
twoFactorAuth()  : string
Check two factor authorization.

Constants

DATE_TIME_FORMAT

public string DATE_TIME_FORMAT = 'Y-m-d H:i:s'

Date time format 'Y-m-d H:i:s'

Properties

$allowedHeaders

public array<string|int, mixed> $allowedHeaders = []

Allowed headers

$allowedMethod

public array<string|int, string> $allowedMethod = ['POST']

Allowed methods

$responseType

public string $responseType = 'data'

Response data type.

$userData

private array<string|int, mixed> $userData = []

User data

Methods

checkAction()

Check called action.

public checkAction() : void
Tags
throws
Exception
Return values
void

getLanguage()

Get current language.

public getLanguage() : string
Return values
string

getParentCrmId()

Get parent record.

public getParentCrmId() : int|null
Tags
throws
Exception
Return values
int|null

getPermissionType()

Get permission type.

public getPermissionType() : int
Return values
int

getUserCrmId()

Get crmid for portal user.

public getUserCrmId() : int
Return values
int

getUserData()

Get user data and session data.

public getUserData(string $key[, string $param = '' ]) : mixed
Parameters
$key : string
$param : string = ''
Return values
mixed

getUserStorageId()

Get user storage ID.

public getUserStorageId() : int
Return values
int

post()

Post method.

public post() : array<string|int, mixed>|null
Tags
throws
Exception
OA\Post

( path="/webservice/WebserviceStandard/Users/Login", description="Logs user into the system", summary="Logs user", tags={"Users"}, security={ {"basicAuth" : }, "ApiKeyAuth" : }} }, @OA\RequestBody( required=true, description="Input data format", @OA\JsonContent(ref="#/components/schemas/Users_Post_Login_Request"), @OA\MediaType( mediaType="multipart/form-data", @OA\Schema(ref="#/components/schemas/Users_Post_Login_Request") ), @OA\MediaType( mediaType="application/x-www-form-urlencoded", @OA\Schema(ref="#/components/schemas/Users_Post_Login_Request") ), ), @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true), @OA\Response( response=200, description="User details", @OA\JsonContent(ref="#/components/schemas/Users_Post_Login_Response"), @OA\XmlContent(ref="#/components/schemas/Users_Post_Login_Response") ), @OA\Response( response=401, description="Invalid data access OR Invalid user password OR No crmid OR 2FA verification error", @OA\JsonContent(ref="#/components/schemas/Exception"), @OA\XmlContent(ref="#/components/schemas/Exception") ), @OA\Response( response=405, description="Invalid method", @OA\JsonContent(ref="#/components/schemas/Exception"), @OA\XmlContent(ref="#/components/schemas/Exception") ), @OA\Response( response=412, description="No 2FA TOTP code", @OA\JsonContent(ref="#/components/schemas/Exception"), @OA\XmlContent(ref="#/components/schemas/Exception") ), ),

OA\SecurityScheme

( type="http", securityScheme="basicAuth", scheme="basic", description="Basic Authentication header" ),

OA\SecurityScheme

( name="X-API-KEY", type="apiKey", in="header", securityScheme="ApiKeyAuth", description="Webservice api key header" ),

OA\Schema

( schema="Header-Encrypted", type="integer", title="Header - Encrypted", description="Is the content request is encrypted", enum={0, 1}, default=0 ),

OA\Schema

( schema="Conditions-Mix-For-Query-Generator", type="object", title="General - Mix conditions for query generator", description="Multiple or one condition for a query generator", oneOf={ @OA\Schema(ref="#/components/schemas/Condition-For-Query-Generator"), @OA\Schema(ref="#/components/schemas/Conditions-For-Query-Generator"), } ),

OA\Schema

( schema="Condition-For-Query-Generator", type="object", title="General - Condition for query generator", description="One condition for query generator", required={"fieldName", "value", "operator"}, @OA\Property(property="fieldName", description="Field name", type="string", example="lastname"), @OA\Property(property="value", description="Search value", type="string", example="Kowalski"), @OA\Property(property="operator", description="Field operator", type="string", example="e"), @OA\Property(property="group", description="Condition group if true is AND", type="boolean", example=true), ),

OA\Schema

( schema="Conditions-For-Query-Generator", type="object", title="General - Conditions for query generator", description="Multiple conditions for query generator", @OA\AdditionalProperties( description="Condition details", type="object", @OA\Schema(ref="#/components/schemas/Condition-For-Query-Generator"), ), ),

OA\Schema

( schema="Conditions-For-Native-Query", type="object", title="General - Conditions for native query", description="Conditions for native query, based on YII 2", example={"column_name1" : "searched value 1", "column_name2" : "searched value 2"}, @OA\ExternalDocumentation( description="Database communication engine", url="https://doc.yetiforce.com/developer-guides/system-components/databases" ), ),

OA\Schema

( schema="Users_Post_Login_Request", title="Users module - Users login request body", description="JSON or form-data", type="object", required={"userName", "password"}, @OA\Property(property="userName", description="Webservice user name", type="string"), @OA\Property(property="password", description="Webservice user password", type="string"), @OA\Property(property="code", description="2FA TOTP code (optional property), Pass code length = 6, Code period = 30", type="string"), @OA\Property( property="params", description="Additional parameters sent by the user, extending the current settings, e.g. language", type="object", @OA\Property(property="language", type="string", description="Users language", example="pl-PL"), ) ),

OA\Schema

( schema="Users_Post_Login_Response", title="Users module - Users login response body", description="Users login response body", type="object", required={"status", "result"}, @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"), @OA\Property( property="result", description="Content of responses from a given method", type="object", required={"token", "name", "lastLoginTime", "lastLogoutTime", "language", "type", "login_method", "preferences"}, @OA\Property(property="token", type="string", minLength=40, maxLength=40), @OA\Property(property="name", type="string"), @OA\Property(property="lastLoginTime", type="string", example="2019-10-07 08:32:38"), @OA\Property(property="lastLogoutTime", type="string", example=""), @OA\Property(property="language", type="string", example="pl-PL"), @OA\Property(property="type", type="integer"), @OA\Property(property="login_method", type="string", enum={"PLL_PASSWORD", "PLL_PASSWORD_2FA"}, example="PLL_PASSWORD_2FA"), @OA\Property(property="logged", type="boolean"), @OA\Property( property="preferences", type="object", required={"hour_format", "start_hour", "end_hour", "date_format", "time_zone", "raw_time_zone", "currency_id", "currency_grouping_pattern", "currency_decimal_separator", "currency_grouping_separator", "currency_symbol_placement", "no_of_currency_decimals", "currency_name", "currency_code", "currency_symbol", "conv_rate"}, @OA\Property(property="hour_format", type="string", example="24"), @OA\Property(property="start_hour", type="string", example="08:00"), @OA\Property(property="end_hour", type="string", example="16:00"), @OA\Property(property="date_format", type="string", example="yyyy-mm-dd"), @OA\Property(property="time_zone", type="string", example="Europe/Warsaw", description="User time zone, all data you will be in this time zone"), @OA\Property(property="raw_time_zone", type="string", example="UTC", description="System main time zone (data in database format)"), @OA\Property(property="currency_id", type="integer", example=1), @OA\Property(property="currency_grouping_pattern", type="string", example="123,456,789"), @OA\Property(property="currency_decimal_separator", type="string", example="."), @OA\Property(property="currency_grouping_separator", type="string", example=" "), @OA\Property(property="currency_symbol_placement", type="string", example="1.0$"), @OA\Property(property="no_of_currency_decimals", type="integer", example=2), @OA\Property(property="currency_name", type="string", example="Poland, Zlotych"), @OA\Property(property="currency_code", type="string", example="PLN"), @OA\Property(property="currency_symbol", type="string", example="zł"), @OA\Property(property="conv_rate", type="number", format="float", example=1.00000), ), @OA\Property(property="authy_methods", type="string", enum={"", "PLL_AUTHY_TOTP"}, example="PLL_AUTHY_TOTP"), @OA\Property(property="2faObligatory", type="boolean", example=true), ), ),

OA\Schema

( schema="Exception", title="General - Error exception", type="object", required={"status", "error"}, @OA\Property(property="status", type="integer", enum={0}, title="0 - error", example=0), @OA\Property( property="error", description="Error details", type="object", required={"message", "code"}, @OA\Property(property="message", type="string", example="Invalid method", description="To show more details turn on: config\Debug.php apiShowExceptionMessages = true"), @OA\Property(property="code", type="integer", example=405), @OA\Property(property="file", type="string", example="api\webservice\WebserviceStandard\BaseAction\Files.php", description="default disabled to enable set: config\Debug.php apiShowExceptionBacktrace = true"), @OA\Property(property="line", type="integer", example=101, description="default disabled to enable set: config\Debug.php apiShowExceptionBacktrace = true"), @OA\Property(property="previous", type="object", description="Previous exception"), @OA\Property(property="backtrace", type="string", example="#0 api\webservice\WebserviceStandard\BaseAction\Files.php (101) ....", description="default disabled to enable set: config\Debug.php apiShowExceptionBacktrace = true"), ), ),

Return values
array<string|int, mixed>|null

preProcess()

Pre process function.

public preProcess() : mixed
Return values
mixed

setAllUserData()

Set user data.

public setAllUserData(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Return values
void

setUserData()

Set user data.

public setUserData(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed
Return values
void

updateSession()

Update user session.

public updateSession([array<string|int, mixed> $data = [] ]) : void
Parameters
$data : array<string|int, mixed> = []
Return values
void

updateUser()

Update user data.

public updateUser([array<string|int, mixed> $data = [] ]) : void
Parameters
$data : array<string|int, mixed> = []
Return values
void

checkAccess()

Check access data.

protected checkAccess() : void
Tags
throws
Exception
Return values
void

checkLifetimeSession()

Check lifetime user session.

protected checkLifetimeSession() : void
Tags
throws
Exception
Return values
void

checkPermission()

Check permission to method.

protected checkPermission() : void
Return values
void

checkPermissionToModule()

Check permission to module.

protected checkPermissionToModule() : void
Return values
void

createSession()

Update user session.

protected createSession() : void
Return values
void

loadSession()

Load user session data .

protected loadSession() : void
Tags
throws
Exception
Return values
void

returnData()

Build data for api response.

protected returnData() : array<string|int, mixed>
Return values
array<string|int, mixed>

saveData()

Save user data and logs.

protected saveData() : void
Return values
void

saveLoginHistory()

Function to store the login history.

protected saveLoginHistory(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Return values
void

twoFactorAuth()

Check two factor authorization.

protected twoFactorAuth() : string
Tags
throws
Exception
Return values
string

        

Search results