classGrantRule
final class GrantRule
Lowers GRANT and REVOKE of MySQL 8.0 and later.
Rule: MYSQL-ACCOUNT-GRANT-001. Scope: grant, revoke (8.0+ productions), opt_with_admin_option, opt_ignore_unknown_user, opt_grant_as. Without an ON clause the list is a list of roles (PT_grant_roles, PT_revoke_roles); with one it is a list of privileges. A user_list account is an account specification without authentication. Constructs: GrantPrivileges, GrantRoles, GrantProxy, RevokePrivileges, RevokeAll, RevokeRoles, RevokeProxy, GrantAs. Terminates: every child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/grant.html, https://dev.mysql.com/doc/refman/8.4/en/revoke.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Calls 1
- new PrivilegeRule line 48
Lowers an 8.0 grant production.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 15
- new ClauseRule line 59
- new GrantRoles line 62
- method-call PrivilegeRule::items() line 63
- method-call Form::node() line 63
- method-call GrantRule::admin() line 65
- new GrantPrivileges line 67
- method-call PrivilegeRule::kind() line 69
- method-call PrivilegeRule::level() line 70
- method-call GrantRule::specifications() line 71
- method-call ClauseRule::grantOptions() line 73
- method-call GrantRule::grantAs() line 74
- method-call GrantRule::all() line 76
- new GrantProxy line 77
- method-call ClauseRule::grantOption() line 80
- static-call ImplementationGap::production() line 82
public function all(Form $form): GrantPrivilegesLowers GRANT ALL [PRIVILEGES] ON … of 8.0.
Parameters
$form | Form |
Returns
Called from 1
Calls 10
- method-call PrivilegeRule::words() line 91
- method-call Form::node() line 91
- new ClauseRule line 92
- new GrantPrivileges line 94
- new AllPrivileges line 95
- method-call PrivilegeRule::kind() line 96
- method-call PrivilegeRule::level() line 97
- method-call GrantRule::specifications() line 98
- method-call ClauseRule::grantOptions() line 100
- method-call GrantRule::grantAs() line 101
Lowers an 8.0 revoke production.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 13
- method-call Form::node() line 112
- function-call
countline 114 - method-call GrantRule::ignore() line 115
- new RevokeRoles line 118
- method-call PrivilegeRule::items() line 120
- new RevokePrivileges line 124
- method-call PrivilegeRule::kind() line 127
- method-call PrivilegeRule::level() line 128
- method-call GrantRule::specifications() line 129
- method-call GrantRule::revokeAll() line 132
- method-call GrantRule::everything() line 133
- new RevokeProxy line 134
- static-call ImplementationGap::production() line 140
public function revokeAll(Form $form, bool $ifExists, bool $ignore): RevokePrivilegesLowers REVOKE ALL [PRIVILEGES] ON … of 8.0.
Parameters
$form | Form | |
$ifExists | bool | |
$ignore | bool |
Returns
Called from 1
Calls 7
- method-call PrivilegeRule::words() line 149
- method-call Form::node() line 149
- new RevokePrivileges line 151
- new AllPrivileges line 151
- method-call PrivilegeRule::kind() line 151
- method-call PrivilegeRule::level() line 151
- method-call GrantRule::specifications() line 151
Lowers REVOKE ALL [PRIVILEGES], GRANT OPTION FROM … of 8.0.
Parameters
$form | Form | |
$ifExists | bool | |
$ignore | bool |
Returns
Called from 1
Calls 4
- method-call PrivilegeRule::words() line 159
- method-call Form::node() line 159
- new RevokeAll line 161
- method-call GrantRule::specifications() line 161
public function specifications(Node $list): non-empty-list<UserSpecification>Lowers a user_list into account specifications without authentication.
Parameters
$list | Node |
Returns
non-empty-list<UserSpecification>Throws
ImplementationGap When a production has no ruleCalled from 8
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:71
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:79
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::all() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:98
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::revoke() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:129
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::revoke() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:137
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::revokeAll() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:151
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::everything() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:161
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::users() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:141
Calls 2
- new UserSpecification line 174
- static-call Check::invariant() line 176
public function admin(Node $option): boolLowers an opt_with_admin_option.
Parameters
$option | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleCalled from 1
Calls 2
- method-call Lowering::form() line 188
- static-call ImplementationGap::production() line 193
public function ignore(Node $option): boolLowers an opt_ignore_unknown_user.
Parameters
$option | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleCalled from 1
Calls 2
- method-call Lowering::form() line 204
- static-call ImplementationGap::production() line 209
Lowers an opt_grant_as; an absent clause is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
Calls 5
- method-call Lowering::form() line 220
- new GrantAs line 224
- method-call RoleRule::withRoles() line 224
- new RoleRule line 224
- static-call ImplementationGap::production() line 225
Private surface 2§
Implementation details, listed for orientation only.
private PrivilegeRule $privilegesprivate Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
GrantRuleTestcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\MySql\Lowering\Account\AccountRules::statement() packages/sql-semantics-mysql/src/Lowering/Account/AccountRules.php:59
- new SqlSemantics\Platform\MySql\Lowering\Account\AccountRules::statement() packages/sql-semantics-mysql/src/Lowering/Account/AccountRules.php:60
- new SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::users() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:141
Method calls 3
- method-call SqlSemantics\Platform\MySql\Lowering\Account\AccountRules::statement() packages/sql-semantics-mysql/src/Lowering/Account/AccountRules.php:59
- method-call SqlSemantics\Platform\MySql\Lowering\Account\AccountRules::statement() packages/sql-semantics-mysql/src/Lowering/Account/AccountRules.php:60
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::users() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:141