Copied!

User

User.php : 22
Extends Content
Implements UserReference

this class represents a content object in a specific version.

Constants

publicDEFAULT_PASSWORD_HASH

User.php : 39
public int DEFAULT_PASSWORD_HASH = self::PASSWORD_HASH_PHP_DEFAULT

Default password hash, used when none is specified, may change over time

publicPASSWORD_HASH_BCRYPT

User.php : 33
public int PASSWORD_HASH_BCRYPT = 6

Passwords in bcrypt

publicPASSWORD_HASH_PHP_DEFAULT

User.php : 36
public int PASSWORD_HASH_PHP_DEFAULT = 7

Passwords hashed by PHPs default algorithm, which may change over time

publicSUPPORTED_PASSWORD_HASHES

User.php : 27
public array<string|int, int> SUPPORTED_PASSWORD_HASHES = [self::PASSWORD_HASH_BCRYPT, self::PASSWORD_HASH_PHP_DEFAULT]

List of supported (by default) hash types.

Properties

public $contentInfo read-only

Content.php
public ContentInfo $contentInfo

@deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use Content::getContentInfo() instead.

public $email read-only

User.php
public string $email

public $enabled read-only

User.php
public bool $enabled

User can not login if false

public $fields read-only

Content.php
public array<string|int, Field$fields

access fields, calls getFields()

public $hashAlgorithm read-only

User.php
public string $hashAlgorithm

Hash algorithm used to hash the password

public $id read-only

Content.php
public int $id

@deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use Content::getId() instead.

public $login read-only

User.php
public string $login

@deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use User::getLogin() instead.

public $maxLogin read-only

User.php
public int $maxLogin

Max number of time user is allowed to login

public $passwordHash read-only

User.php
public string $passwordHash

@deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use User::getPasswordHash() instead.

public $passwordUpdatedAt read-only

User.php
public DateTimeInterface|null $passwordUpdatedAt

public $thumbnail read-only

Content.php
public Thumbnail|null $thumbnail

calls getThumbnail()

public $versionInfo read-only

Content.php
public VersionInfo $versionInfo

calls getVersionInfo()

protected $email

User.php : 53

User E-Mail address.

protected string $email

protected $enabled

User.php : 83

Flag to signal if user is enabled or not.

protected bool $enabled = false

User can not login if false

protected $hashAlgorithm

User.php : 74

Hash algorithm used to hash the password.

protected int $hashAlgorithm

protected $login

User.php : 46

User login.

protected string $login

protected $maxLogin

User.php : 93

Max number of time user is allowed to login.

protected int $maxLogin
Tags
Todo:

Not used in kernel, should probably be a number of login allowed before changing password. But new users gets 0 before they activate, admin has 10, and anonymous has 1000 in clean data.

protected $passwordHash

User.php : 60

User password hash.

protected string $passwordHash

protected $passwordUpdatedAt

User.php : 67

Datetime of last password update.

protected DateTimeInterface|null $passwordUpdatedAt

Methods

public__construct()

ValueObject.php : 30

Construct object optionally with a set of properties.

public __construct([array<string|int, mixed> $properties = [] ])

Readonly properties values must be set using $properties as they are not writable anymore after object has been created.

Parameters

Name Type Default value Description
$properties array<string|int, mixed> [] -

publicgetContentInfo()

Content.php : 31
public getContentInfo() : ContentInfo

Return values

ContentInfo

publicgetContentType()

Content.php : 119

Returns the ContentType for this content.

public abstract getContentType() : ContentType

Return values

ContentType

publicgetDefaultLanguageCode()

Content.php : 123
public abstract getDefaultLanguageCode() : string

Return values

string

publicgetField()

Content.php : 112

This method returns the field for a given field definition identifier and language.

public abstract getField(string $fieldDefIdentifier[, string|null $languageCode = null ]) : Field|null
  • If $languageCode is defined, return if available, otherwise null
  • If not pick using the following languages codes when applicable:
    1. Prioritized languages (if provided to api on object retrieval)
    2. Main language

On non translatable fields this method ignores the languageCode parameter, and return main language field.

Parameters

Name Type Default value Description
$fieldDefIdentifier string - -
$languageCode string|null null -

Return values

Field|null

A Field or null if nothing is found

publicgetFields()

Content.php : 81

This method returns the complete fields collection.

public abstract getFields() : array<string|int, Field>

Return values

array<string|int, Field>

An array of Field

publicgetFieldsByLanguage()

Content.php : 94

This method returns the fields for a given language and non translatable fields.

public abstract getFieldsByLanguage([string|null $languageCode = null ]) : array<string|int, Field>
  • If $languageCode is defined, return if available
  • If not pick using prioritized languages (if provided to api on object retrieval)
  • Otherwise return in main language

Parameters

Name Type Default value Description
$languageCode string|null null -

Return values

array<string|int, Field>

An array of Field with field identifier as keys

publicgetFieldValue()

Content.php : 74

Returns a field value for the given value.

public abstract getFieldValue(string $fieldDefIdentifier[, string|null $languageCode = null ]) : Value|null
  • If $languageCode is defined, return if available, otherwise null
  • If not pick using the following languages codes when applicable:
    1. Prioritized languages (if provided to api on object retrieval)
    2. Main language

On non translatable fields this method ignores the languageCode parameter, and return main language field value.

Parameters

Name Type Default value Description
$fieldDefIdentifier string - -
$languageCode string|null null -

Return values

Value|null

a primitive type or a field type Value object depending on the field type.

publicgetId()

Content.php : 26
public getId() : int

Return values

int

publicgetLogin()

User.php : 101
public getLogin() : string

Return values

string

publicgetName()

Content.php : 53

Shorthand method for getVersionInfo()->getName().

public getName([string|null $languageCode = null ]) : string|null

Parameters

Name Type Default value Description
$languageCode string|null null -

Return values

string|null

The name for a given language, or null if $languageCode is not set or does not exist.

publicgetPasswordHash()

User.php : 106
public getPasswordHash() : string

Return values

string

publicgetThumbnail()

Content.php : 121
public abstract getThumbnail() : Thumbnail|null

Return values

Thumbnail|null

publicgetUserId()

User.php : 95

The User id of the User this reference represent.

public getUserId() : int

Return values

int

publicgetVersionInfo()

Content.php : 41

Returns the VersionInfo for this version.

public abstract getVersionInfo() : VersionInfo

Return values

VersionInfo

protectedgetProperties()

ValueObject.php : 50

Function where list of properties are returned.

protected getProperties([array<string|int, mixed> $dynamicProperties = [] ]) : array<string|int, mixed>

Used by attributes(), override to add dynamic properties

Parameters

Name Type Default value Description
$dynamicProperties array<string|int, mixed> []

Additional dynamic properties exposed on the object

Return values

array<string|int, mixed>