classRevokeRole
final class RevokeRole
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to remove roles from the membership of other roles, or to remove one membership option only.
Rule: PG-REVOKE-ROLE-001. Mirrors GrantRoleStmt without is_grant: the revoked roles, the member roles, the option of name OPTION FOR (the membership stays and only that option is turned off), GRANTED BY and CASCADE or RESTRICT as written. Checked as a role grant (PG-MEMBERSHIP-CHECK-001). Source: https://www.postgresql.org/docs/17/sql-revoke.html. Status: Implemented.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('REVOKE ADMIN OPTION FOR staff FROM joe');
[$operation->statement->option?->value, $operation->statement->roles[0]->privilege()] // => ['admin', 'staff']Properties§
public non-empty-list<Privilege> $rolespublic non-empty-list<RoleSpec> $memberspublic Name|null $option = nullpublic RoleSpec|null $grantor = nullpublic DropBehavior|null $behavior = nullMethods§
public function __construct(
list<Privilege> $roles,
list<RoleSpec> $members,
public Name|null $option = null,
public RoleSpec|null $grantor = null,
public DropBehavior|null $behavior = null,
)Parameters
$roles | list<Privilege> | The revoked roles in the order written, at least one |
$members | list<RoleSpec> | The roles that lose the membership, at least one |
$option | Name|null | The option of `name OPTION FOR`, when written |
$grantor | RoleSpec|null | The role of GRANTED BY, when written |
$behavior | DropBehavior|null | CASCADE or RESTRICT, when written |
Calls 4
- method-call PrivilegeLists::roles() line 57
- new PrivilegeLists line 57
- static-call Check::listOf() line 58
- class-const RoleSpec::class() line 58
public function deriveStatement(Derivation $derivation): voidReports the problems of the roles and of the option.
Parameters
$derivation | Derivation |
Calls 5
- new MembershipChecks line 66
- method-call MembershipChecks::roles() line 67
- function-call
in_arrayline 68 - class-const MembershipOption::RECOGNIZED() line 68
- method-call MembershipChecks::option() line 69
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 78
- method-call Output::name() line 80
- class-const NameUse::Column() line 80
- method-call Output::list() line 82
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Access\MembershipRule::statement() packages/sql-semantics-postgres/src/Lowering/Access/MembershipRule.php:62
- new SqlSemantics\Platform\PostgreSql\Lowering\Access\MembershipRule::statement() packages/sql-semantics-postgres/src/Lowering/Access/MembershipRule.php:63