classGrantRoles
final class GrantRoles
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.GRANT role, … TO account, … [WITH ADMIN OPTION] (8.0+): a request to grant roles.
Mirrors PT_grant_roles. Rule: MYSQL-GRANT-ROLES-001. The grammar reads any item of the list; an item that is no role (a static privilege, or a dynamic privilege with a column list) is a RoleOrPrivilegeMismatch by MYSQL-PRIVILEGE-CHECKS-001. A dynamic privilege written without columns reads as a role here and is not accepted by the constructor. Source: https://dev.mysql.com/doc/refman/8.4/en/grant.html#grant-roles. Status: Implemented.
(new \SqlSemantics\Platform\MySql\Semantics())->analyze("grant r1, 'r2'@'%' to u with admin option")->toString() // => 'GRANT r1, r2@`%` TO u WITH ADMIN OPTION'Properties§
public list<Grantable> $rolespublic list<Account> $userspublic bool $withAdminOption = falseMethods§
public function __construct(
list<Grantable> $roles,
list<Account> $users,
public bool $withAdminOption = false,
)Parameters
Calls 4
- static-call Check::listOf() line 53
- class-const Grantable::class() line 53
- class-const Account::class() line 54
- static-call Check::input() line 56
public function deriveStatement(Derivation $derivation): voidReports the items that are no roles.
Parameters
$derivation | Derivation |
Calls 2
- method-call PrivilegeChecks::roles() line 65
- new PrivilegeChecks line 65
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
GrantRolesTestcalls