Files
supabase/apps/studio/data/privileges/keys.ts
Alaister Young 9652e8c4d3 [SEC-385] feat(studio): Add default privileges for new entities toggle (#43583)
Adds a new toggle in:
<img width="1161" height="356" alt="Screenshot 2026-03-10 at 17 17 06"
src="https://github.com/user-attachments/assets/b09ac1aa-a8f5-4fb4-8771-f113b140eac8"
/>

Other changes:
- form submissions with no table/function changes were failing because
an empty string got passed to executeSql. Added an early return when
there's nothing to execute

To test:
- Ensure the form is still in working order
- Create some tables and functions with the toggle on add off and make
sure your selected default applies
2026-03-12 09:38:03 +00:00

47 lines
1.5 KiB
TypeScript

export const privilegeKeys = {
tablePrivilegesList: (projectRef: string | undefined) =>
['projects', projectRef, 'database', 'table-privileges'] as const,
columnPrivilegesList: (projectRef: string | undefined) =>
['projects', projectRef, 'database', 'column-privileges'] as const,
exposedTablesInfinite: (projectRef: string | undefined, search?: string) =>
[
'projects',
projectRef,
'privileges',
'exposed-tables-infinite',
...(search ? ([{ search }] as const) : []),
] as const,
exposedTableCounts: (projectRef: string | undefined, selectedSchemas?: string[]) =>
[
'projects',
projectRef,
'privileges',
'exposed-table-counts',
...(selectedSchemas ? ([selectedSchemas] as const) : []),
] as const,
exposedFunctionsInfinite: (projectRef: string | undefined, search?: string) =>
[
'projects',
projectRef,
'privileges',
'exposed-functions-infinite',
...(search ? ([{ search }] as const) : []),
] as const,
exposedFunctionCounts: (projectRef: string | undefined, selectedSchemas?: string[]) =>
[
'projects',
projectRef,
'privileges',
'exposed-function-counts',
...(selectedSchemas ? ([selectedSchemas] as const) : []),
] as const,
defaultPrivileges: (projectRef: string | undefined, schema?: string) =>
[
'projects',
projectRef,
'privileges',
'default-privileges',
...(schema ? [schema] : []),
] as const,
}