ApiDoc BACKEND

User extends UserIdentity

Clase padre para la clase User que hereda atributos de {@see IdentityInterface}. Se trata de un clon de la otorgada por la librería user management.

Modelo que hereda atributos de UserIdentity. Actualmente en desuso.

Table of Contents

Constants

STATUS_ACTIVE  = 1
STATUS_BANNED  = -1
STATUS_INACTIVE  = 0

Properties

$auth_key  : string
$bind_to_ip  : string
$confirmation_token  : string
$created_at  : int
$email  : string
$email_confirmed  : int
$gridRoleSearch  : string
$id  : int
$password  : string
$password_hash  : string
$registration_ip  : string
$repeat_password  : string
$status  : int
$superadmin  : int
$updated_at  : int
$username  : string

Methods

assignRole()  : bool
Assign role to user
attributeLabels()  : array<string|int, mixed>
beforeDelete()  : mixed
Don't let delete yourself and don't let non-superadmin delete superadmin
beforeSave()  : mixed
Make sure user will not deactivate himself and superadmin could not demote himself Also don't let non-superadmin edit superadmin
behaviors()  : mixed
canRoute()  : bool
Useful for Menu widget
findByConfirmationToken()  : static|null|User
Finds user by confirmation token
findByUsername()  : static|null
Finds user by username
findIdentity()  : mixed
findIdentityByAccessToken()  : mixed
findInactiveByConfirmationToken()  : static|null|User
Finds user by confirmation token
generateAuthKey()  : mixed
Generates "remember me" authentication key
generateConfirmationToken()  : mixed
Generates new confirmation token
getAuthKey()  : mixed
getCurrentUser()  : static
Store result in singleton to prevent multiple db requests with multiple calls
getId()  : mixed
getRoles()  : ActiveQuery
getStatusList()  : array<string|int, mixed>
getStatusList
getStatusValue()  : string
getStatusValue
hasPermission()  : bool
hasRole()  : bool
removeConfirmationToken()  : mixed
Removes confirmation token
revokeRole()  : bool
Revoke role from user
rules()  : mixed
setPassword()  : mixed
Generates password hash from password and sets it to the model
tableName()  : mixed
validateAuthKey()  : mixed
validateBindToIp()  : mixed
Validate bind_to_ip attr to be in correct format
validateEmailConfirmedUnique()  : mixed
Check that there is no such confirmed E-mail in the system
validatePassword()  : bool
Validates password

Constants

STATUS_ACTIVE

public mixed STATUS_ACTIVE = 1

STATUS_BANNED

public mixed STATUS_BANNED = -1

STATUS_INACTIVE

public mixed STATUS_INACTIVE = 0

Properties

$auth_key

public string $auth_key

$bind_to_ip

public string $bind_to_ip

$confirmation_token

public string $confirmation_token

$created_at

public int $created_at

$email

public string $email

$email_confirmed

public int $email_confirmed

$gridRoleSearch

public string $gridRoleSearch

$password

public string $password

$password_hash

public string $password_hash

$registration_ip

public string $registration_ip

$repeat_password

public string $repeat_password

$status

public int $status

$superadmin

public int $superadmin

$updated_at

public int $updated_at

$username

public string $username

Methods

assignRole()

Assign role to user

public static assignRole(int $userId, string $roleName) : bool
Parameters
$userId : int
$roleName : string
Return values
bool

attributeLabels()

public attributeLabels() : array<string|int, mixed>
Return values
array<string|int, mixed>

beforeDelete()

Don't let delete yourself and don't let non-superadmin delete superadmin

public beforeDelete() : mixed
Tags
inheritdoc

beforeSave()

Make sure user will not deactivate himself and superadmin could not demote himself Also don't let non-superadmin edit superadmin

public beforeSave(mixed $insert) : mixed
Parameters
$insert : mixed
Tags
inheritdoc

behaviors()

public behaviors() : mixed
Tags
inheritdoc

canRoute()

Useful for Menu widget

public static canRoute(string|array<string|int, mixed> $route[, bool $superAdminAllowed = true ]) : bool
... [ 'label'=>'Some label', 'url'=>['/site/index'], 'visible'=>User::canRoute(['/site/index']) ] ...
Parameters
$route : string|array<string|int, mixed>
$superAdminAllowed : bool = true
Return values
bool

findByConfirmationToken()

Finds user by confirmation token

public static findByConfirmationToken(string $token) : static|null|User
Parameters
$token : string

confirmation token

Return values
static|null|User

findByUsername()

Finds user by username

public static findByUsername(string $username) : static|null
Parameters
$username : string
Return values
static|null

findIdentity()

public static findIdentity(mixed $id) : mixed
Parameters
$id : mixed
Tags
inheritdoc

findIdentityByAccessToken()

public static findIdentityByAccessToken(mixed $token[, mixed $type = null ]) : mixed
Parameters
$token : mixed
$type : mixed = null
Tags
inheritdoc

findInactiveByConfirmationToken()

Finds user by confirmation token

public static findInactiveByConfirmationToken(string $token) : static|null|User
Parameters
$token : string

confirmation token

Return values
static|null|User

generateAuthKey()

Generates "remember me" authentication key

public generateAuthKey() : mixed

generateConfirmationToken()

Generates new confirmation token

public generateConfirmationToken() : mixed

getAuthKey()

public getAuthKey() : mixed
Tags
inheritdoc

getCurrentUser()

Store result in singleton to prevent multiple db requests with multiple calls

public static getCurrentUser([bool $fromSingleton = true ]) : static
Parameters
$fromSingleton : bool = true
Return values
static

getRoles()

public getRoles() : ActiveQuery
Return values
ActiveQuery

getStatusList()

getStatusList

public static getStatusList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStatusValue()

getStatusValue

public static getStatusValue(string $val) : string
Parameters
$val : string
Return values
string

hasPermission()

public static hasPermission(string $permission[, bool $superAdminAllowed = true ]) : bool
Parameters
$permission : string
$superAdminAllowed : bool = true
Return values
bool

hasRole()

public static hasRole(string|array<string|int, mixed> $roles[, bool $superAdminAllowed = true ]) : bool
Parameters
$roles : string|array<string|int, mixed>
$superAdminAllowed : bool = true
Return values
bool

removeConfirmationToken()

Removes confirmation token

public removeConfirmationToken() : mixed

revokeRole()

Revoke role from user

public static revokeRole(int $userId, string $roleName) : bool
Parameters
$userId : int
$roleName : string
Return values
bool

rules()

public rules() : mixed
Tags
inheritdoc

setPassword()

Generates password hash from password and sets it to the model

public setPassword(string $password) : mixed
Parameters
$password : string

tableName()

public static tableName() : mixed
Tags
inheritdoc

validateAuthKey()

public validateAuthKey(mixed $authKey) : mixed
Parameters
$authKey : mixed
Tags
inheritdoc

validateBindToIp()

Validate bind_to_ip attr to be in correct format

public validateBindToIp() : mixed

validateEmailConfirmedUnique()

Check that there is no such confirmed E-mail in the system

public validateEmailConfirmedUnique() : mixed

validatePassword()

Validates password

public validatePassword(string $password) : bool
Parameters
$password : string

password to validate

Return values
bool

if password provided is valid for current user


        
On this page

Search results