final class UserSpecification
    implements UserAlteration
    uses Snapshot
Public API: explicitly declared with @visibility public.

One account of CREATE USER, ALTER USER or a MySQL 5.x GRANT, with what the statement sets for its authentication.

Mirrors LEX_USER: the account, its first authentication method, the further factors of CREATE USER (AND IDENTIFIED …, 8.0.27+), the initial authentication of a passwordless account (INITIAL AUTHENTICATION …), and the ALTER USER password management words: REPLACE 'current', RETAIN CURRENT PASSWORD, DISCARD OLD PASSWORD. Passwords are operands with their exact values. The constructor accepts only the combinations the grammar can write, so the rendering reads back as the same specification. Source: https://dev.mysql.com/doc/refman/8.4/en/create-user.html, https://dev.mysql.com/doc/refman/8.4/en/alter-user.html, https://dev.mysql.com/doc/refman/8.4/en/multifactor-authentication.html.

Reading the password of an accountdoctest
$user = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("CREATE USER app IDENTIFIED BY 'secret'")->statement->users[0];
    $user->identification?->secret?->value // => 'secret'

Properties§

public list<Identification> $factors
public Identification|null $identification = null
public Identification|null $initial = null
public Text|null $replace = null
public bool $retainCurrent = false
public bool $discardOld = false

Methods§

public function __construct(
    public Account|SessionUser $user,
    public Identification|null $identification = null,
    list<Identification> $factors = [],
    public Identification|null $initial = null,
    public Text|null $replace = null,
    public bool $retainCurrent = false,
    public bool $discardOld = false,
)

Parameters

$userAccount|SessionUserThe account
$identificationIdentification|nullThe first authentication method, when written
$factorslist<Identification>The further factors written with AND; at most two
$initialIdentification|nullThe INITIAL AUTHENTICATION method of a passwordless first factor
$replaceText|nullThe current password REPLACE names
$retainCurrentboolWhether RETAIN CURRENT PASSWORD is written
$discardOldboolWhether DISCARD OLD PASSWORD is written
Calls 5
public function granted(): bool

Tells whether a GRANT or REVOKE account list can write the specification: a named account with at most its first method.

Returns

bool
Test cases 1
public function created(): bool

Tells whether CREATE USER can write the specification: a named account without password management words.

Returns

bool
Test cases 1
public function altered(): bool

Tells whether ALTER USER can write the specification: an account without further factors and initial authentication.

Returns

bool
Test cases 1
public function render(Output $out): void

Writes the account and its clauses.

Parameters

$outOutput
Calls 2

Test cases 4§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3
Other tests reaching this symbol 1

Relations§

Instantiated in 11
Constant reads 6
Type checks 3
Type declarations 2