classRevoke
final class Revoke
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to revoke privileges on objects, or only the right to grant them, from roles.
Rule: PG-REVOKE-001. Mirrors GrantStmt without is_grant: the privileges (an empty list is ALL PRIVILEGES), the objects, the roles, GRANT OPTION FOR, GRANTED BY and CASCADE or RESTRICT as written. The objects and privileges are derived and checked as for GRANT. Source: https://www.postgresql.org/docs/17/sql-revoke.html. Status: Implemented.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('REVOKE GRANT OPTION FOR SELECT ON accounts FROM joe CASCADE');
[$operation->statement->grantOptionOnly, $operation->statement->behavior?->value] // => [true, 'CASCADE']Properties§
public list<Privilege> $privilegespublic non-empty-list<RoleSpec> $granteespublic PrivilegeTarget $targetpublic bool $grantOptionOnly = falsepublic RoleSpec|null $grantor = nullpublic DropBehavior|null $behavior = nullMethods§
public function __construct(
list<Privilege> $privileges,
public PrivilegeTarget $target,
list<RoleSpec> $grantees,
public bool $grantOptionOnly = false,
public RoleSpec|null $grantor = null,
public DropBehavior|null $behavior = null,
)Parameters
$privileges | list<Privilege> | The privileges in the order written; empty for ALL PRIVILEGES |
$target | PrivilegeTarget | The objects the privileges are revoked on |
$grantees | list<RoleSpec> | The roles the privileges are revoked from, at least one |
$grantOptionOnly | bool | Whether GRANT OPTION FOR is written: only the right to grant is revoked |
$grantor | RoleSpec|null | The role of GRANTED BY, when written |
$behavior | DropBehavior|null | CASCADE or RESTRICT, when written |
Calls 4
- method-call PrivilegeLists::privileges() line 57
- new PrivilegeLists line 57
- static-call Check::listOf() line 58
- class-const RoleSpec::class() line 58
public function deriveStatement(Derivation $derivation): voidDerives the objects and reports the problems of the privileges and the grantor.
Parameters
$derivation | Derivation |
Calls 6
- method-call PrivilegeChecks::privileges() line 66
- new PrivilegeChecks line 66
- method-call PrivilegeTarget::object() line 66
- method-call RoleChecks::existing() line 68
- new RoleChecks line 68
- method-call PrivilegeTarget::deriveTarget() line 70
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 78
- method-call PrivilegeLists::write() line 82
- new PrivilegeLists line 82
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.