Skip to main content

Module list_audience_grants_table_function

Module list_audience_grants_table_function 

Source
Expand description

Caller-scoped UDTF listing rows of the audience_grants table list_audience_grants() – caller-scoped UDTF listing rows of the audience_grants table. Modeled on list_query_denials_table_function.rs’s shape (a TableFunctionImpl whose sync call_with_args returns a lazy TableProvider, an async scan that runs the DB query and builds arrays), but registered outside the admin gate in register_lakehouse_functions, next to list_view_sets() – every authenticated caller (and, per is_admin(metadata)’s documented --disable-auth convention, every caller when auth is disabled) can call it, scoped by crate::lakehouse::list_audience_grants_table_function::GrantVisibility.

Visibility. Admin: every row. Non-admin: every grant on each (audience, axis) pair the caller holds a matching grant on – deliberately wider than “rows whose selector matches me”: if a caller may read an audience, they may see who else may, which is exactly the “who can see this audience” question the Audience Access page (and this function) exists to answer. An empty selector list (CallerContext::internal(), or an identity-less caller once the always-present "*" is stripped – see scan) yields zero rows. A maintenance caller and a request with no AuthContext at all (--disable-auth) are both is_admin: true and take the All branch below instead, never Held.

What this is not. This function reads the DB table directly on every call, never DbAudienceGrantsSource’s TTL snapshot, so a write is visible immediately. It also does not (and structurally cannot) apply analytics-web-srv’s self_service_mint_enabled knob – see the REST GET .../audience-grants/visible route for the knob-aware narrowing that backs the Audience Access page’s own list; this function is the always-on SQL auditing surface, like list_query_denials().

Structs§

ListAudienceGrantsTableFunction
A DataFusion TableFunctionImpl for list_audience_grants().

Enums§

GrantVisibility
How much of the audience_grants table scan returns, decided once at registration time in register_lakehouse_functions from CallerContext::is_admin/grant_selectors.