Skip to content

proto(sql): add GetSqlIdentity RPC to v1alpha3 SQLService [UX-1330]#2523

Closed
c-julin wants to merge 1 commit into
masterfrom
jc/sql-get-identity
Closed

proto(sql): add GetSqlIdentity RPC to v1alpha3 SQLService [UX-1330]#2523
c-julin wants to merge 1 commit into
masterfrom
jc/sql-get-identity

Conversation

@c-julin

@c-julin c-julin commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What

Adds a GetSqlIdentity RPC to the v1alpha3 SQLService plus regenerated Go/TS clients and v1alpha3 OpenAPI.

rpc GetSqlIdentity(GetSqlIdentityRequest) returns (GetSqlIdentityResponse);

message GetSqlIdentityResponse {
  string current_user = 1; // engine username (SQL current_user)
  bool   is_admin = 2;     // superuser? sourced from pg_roles.rolsuper
}

Gated on PERMISSION_VIEW / API_REDPANDA_SQL, same as the other SQL RPCs; HTTP GET /v1alpha3/sql/identity.

Why

The SQL editor UI needs to distinguish a SQL admin from a viewer to show/hide write actions (e.g. the create-table wizard). There is currently no signal for this — the frontend hardcodes sqlRole = 'viewer'. The engine (Oxla) is the source of truth: admin == rolsuper. This RPC surfaces that so the UI can gate the button on a real capability rather than assuming a role. The engine still enforces privileges on execution regardless.

Validated against a live Oxla cluster: SELECT rolname, rolsuper FROM pg_roles WHERE rolname = current_user returns t for an admin (oxla) and f for a created viewer.

Notes

  • Generated files only; the handler is implemented enterprise-side (console-enterprise PR, stacked on the in-flight SQL work).
  • Regeneration via task proto:generate; unrelated whitespace churn in v1alpha2 OpenAPI examples was reverted (CI uses git diff -w).

Ref UX-1330.

GetSqlIdentity returns the caller's engine username and whether it holds
administrative (superuser) privileges, so the UI can gate write/DDL actions
(e.g. the create-table wizard) on a real signal rather than assuming a role.

Proto + regenerated Go/TS clients and v1alpha3 OpenAPI. Enterprise implements
the handler against pg_roles.rolsuper.
@github-actions

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / validate (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 22, 2026, 6:31 PM

@c-julin

c-julin commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #2524 (renamed branch to sql-get-identity to match the enterprise PR and the sql-* branch family).

@c-julin c-julin closed this Jun 22, 2026
@c-julin c-julin deleted the jc/sql-get-identity branch June 22, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant