final class PrivilegeRule
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Lowers the privilege lists, column lists and privilege levels of GRANT and REVOKE.

Rule: MYSQL-ACCOUNT-PRIVILEGE-001. Scope: role_or_privilege_list, role_or_privilege (8.0+), grant_privileges, object_privilege_list, object_privilege (5.x), opt_privileges, opt_column_list, column_list, column_list_id, grant_ident, opt_acl_type. A static privilege maps to its PrivilegeKind by the words written; a name alone is a role in a role list and a dynamic privilege in a privilege list, as the server reads PT_role_or_dynamic_privilege; a name with a column list is a dynamic privilege (PT_dynamic_privilege); a name with a host is a role (PT_role_at_host). ALL [PRIVILEGES] is AllPrivileges. The level is *.*, *, db.* or an object name; an absent or TABLE kind is a table. Constructs: StaticPrivilege, DynamicPrivilege, GrantedRole, AllPrivileges, GlobalLevel, CurrentDatabaseLevel, DatabaseLevel, ObjectLevel. Terminates: lists are flattened iteratively; every other child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/grant.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function item(Node $item, bool $roles): Grantable
public function named(Name $name, list<Name> $columns, bool $roles): Grantable

Reads a name with its column list: a role in a role list when no columns are written, a dynamic privilege otherwise.

Parameters

$nameName
$columnslist<Name>
$rolesbool

Returns

Called from 1
Calls 3
public function privileges(Node $privileges): non-empty-list<Grantable>
public function column(Node $column): Name

Lowers one column of a column list.

Parameters

$columnNode

Returns

Throws

ImplementationGap When the production has no rule
Called from 1
Calls 2

Private surface 3§

Implementation details, listed for orientation only.

private const STATIC = ['object_privilege: ALTER' => \SqlSemantics\Platform\MySql\Statement\Account\Pr…
private const LISTS = ['role_or_privilege_list: role_or_privilege' => true, 'role_or_privilege_list: …
private Lowering $lowering

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 3
Method calls 20
Type declarations 1