Documentation

User
in package

The User class holds information about the user

Table of Contents

$execUserId  : int
$fields  : array<string|int, mixed>
$isLoggedIn  : bool
$userId  : int
$permissionsByUserCache  : mixed
$sessionToken  : string|null
__construct()  : mixed
checkPermission()  : bool
Checks if a user has a given permission
checkPermissionOf()  : bool
checkSuperPermission()  : bool
getSessionToken()  : string|null
identify()  : mixed
Checks if the user is registered. Checks by the z_login_token cookie.
anonymousRequest()  : mixed

Properties

$execUserId

public int $execUserId = null

ID of the user that is logged in as this user.

Null represents an anonymous user

$fields

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

Holds the dataset from the database of this user

$isLoggedIn

public bool $isLoggedIn = false

Holds if the user is logged in

$userId

public int $userId = null

ID of the user in the database.

Null represents an anonymous user

$permissionsByUserCache

private mixed $permissionsByUserCache = []

string[int] $permissionsByUserCache Array of permissions the user has, cached by user ID.

$sessionToken

private string|null $sessionToken = null

The token used to authenticate the current session

Methods

__construct()

public __construct() : mixed
Return values
mixed

checkPermission()

Checks if a user has a given permission

public checkPermission(string $permission) : bool
Parameters
$permission : string

Name of the permission

Return values
bool

True when the permission is given

checkPermissionOf()

public checkPermissionOf(mixed $permission, int $userId) : bool
Parameters
$permission : mixed
$userId : int
Return values
bool

checkSuperPermission()

public checkSuperPermission(mixed $permission) : bool
Parameters
$permission : mixed
Return values
bool

getSessionToken()

public getSessionToken() : string|null
Return values
string|null

identify()

Checks if the user is registered. Checks by the z_login_token cookie.

public identify() : mixed

The properties $isLoggedIn, $userId, and $execUserId will be set after calling this function.

Return values
mixed

anonymousRequest()

private anonymousRequest() : mixed
Return values
mixed

Search results