classDefaultGrant
final class DefaultGrant
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The GRANT action of ALTER DEFAULT PRIVILEGES: privileges future objects of a kind receive.
Mirrors the GrantStmt of DefACLAction with the target type ACL_TARGET_DEFAULTS: the privileges (an empty list is ALL PRIVILEGES), the kind of object, the grantees and WITH GRANT OPTION. Source: https://www.postgresql.org/docs/17/sql-alterdefaultprivileges.html.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER DEFAULT PRIVILEGES GRANT insert ON TABLES TO joe WITH GRANT OPTION');
[$operation->statement->action->objects->value, $operation->statement->action->grantOption] // => ['TABLES', true]Properties§
public list<Privilege> $privilegespublic non-empty-list<RoleSpec> $granteespublic DefaultObjectKind $objectspublic bool $grantOption = falseMethods§
public function __construct(
list<Privilege> $privileges,
public DefaultObjectKind $objects,
list<RoleSpec> $grantees,
public bool $grantOption = false,
)Parameters
$privileges | list<Privilege> | The privileges in the order written; empty for ALL PRIVILEGES |
$objects | DefaultObjectKind | The kind of object the defaults are set for |
$grantees | list<RoleSpec> | The grantees in the order written, at least one |
$grantOption | bool | Whether WITH GRANT OPTION is written |
Calls 4
- method-call PrivilegeLists::privileges() line 50
- new PrivilegeLists line 50
- static-call Check::listOf() line 51
- class-const RoleSpec::class() line 51
public function render(Output $out): voidWrites the action.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 59
- method-call PrivilegeLists::write() line 60
- new PrivilegeLists line 60
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 1
Type checks 1
Type declarations 3
- type SqlSemantics\Platform\PostgreSql\Lowering\Access\DefaultPrivilegeRule packages/sql-semantics-postgres/src/Lowering/Access/DefaultPrivilegeRule.php:104
- type SqlSemantics\Platform\PostgreSql\Rules\Access\DefaultPrivilegeChecks packages/sql-semantics-postgres/src/Rules/Access/DefaultPrivilegeChecks.php:38
- type SqlSemantics\Platform\PostgreSql\Statement\Catalog\Access\Defaults\AlterDefaultPrivileges packages/sql-semantics-postgres/src/Statement/Catalog/Access/Defaults/AlterDefaultPrivileges.php:43