Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore(studio): custom docs rls guide path (#39480)

Alaister Youngd30e4d3aa043
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/CLSPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/CLSPreview.tsx
index ddf714506d9..748ec6cec44 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/CLSPreview.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/CLSPreview.tsx
@@ -3,12 +3,15 @@ import Image from 'next/image'
import { useParams } from 'common'
import { Markdown } from 'components/interfaces/Markdown'
import { InlineLink } from 'components/ui/InlineLink'
+import { useCustomContent } from 'hooks/custom-content/useCustomContent'
import { BASE_PATH, DOCS_URL } from 'lib/constants'
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, WarningIcon } from 'ui'
export const CLSPreview = () => {
const { ref } = useParams()
+ const { docsRowLevelSecurityGuidePath } = useCustomContent(['docs:row_level_security_guide_path'])
+
return (
<div className="flex flex-col gap-2">
<div className="mb-4 flex flex-col gap-y-2">
@@ -18,7 +21,7 @@ export const CLSPreview = () => {
/>
<Markdown
className="text-foreground-light max-w-full"
- content={`This is an advanced feature and should be used with caution. Unless you have a very specific use case, we recommend just using [Row-Level Security](${DOCS_URL}/guides/auth/row-level-security).`}
+ content={`This is an advanced feature and should be used with caution. Unless you have a very specific use case, we recommend just using [Row-Level Security](${DOCS_URL}${docsRowLevelSecurityGuidePath}).`}
/>
<Alert_Shadcn_ variant="warning" className="mt-2">
<WarningIcon />
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/RLSDisableModal.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/RLSDisableModal.tsx
index 114d5df7c3d..b9f18ae1d18 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/RLSDisableModal.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/RLSDisableModal.tsx
@@ -1,10 +1,13 @@
import { AlertOctagon, Lock, ShieldOff } from 'lucide-react'
import { DocsButton } from 'components/ui/DocsButton'
+import { useCustomContent } from 'hooks/custom-content/useCustomContent'
import { DOCS_URL } from 'lib/constants'
import { Alert } from 'ui'
export default function RLSDisableModalContent() {
+ const { docsRowLevelSecurityGuidePath } = useCustomContent(['docs:row_level_security_guide_path'])
+
return (
<div className="text-sm text-foreground-light grid gap-4">
<div className="grid gap-1">
@@ -47,7 +50,7 @@ export default function RLSDisableModalContent() {
<DocsButton
abbrev={false}
className="w-min mt-3"
- href={`${DOCS_URL}/guides/auth/row-level-security`}
+ href={`${DOCS_URL}${docsRowLevelSecurityGuidePath}`}
/>
</div>
)
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
index 8c9dbacc7e5..780093e1517 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
@@ -16,6 +16,7 @@ import {
} from 'data/database/foreign-key-constraints-query'
import { useEnumeratedTypesQuery } from 'data/enumerated-types/enumerated-types-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
+import { useCustomContent } from 'hooks/custom-content/useCustomContent'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
@@ -89,6 +90,8 @@ export const TableEditor = ({
const { realtimeAll: realtimeEnabled } = useIsFeatureEnabled(['realtime:all'])
const { mutate: sendEvent } = useSendEventMutation()
+ const { docsRowLevelSecurityGuidePath } = useCustomContent(['docs:row_level_security_guide_path'])
+
const [params, setParams] = useUrlState()
useEffect(() => {
if (params.create === 'table' && snap.ui.open === 'none') {
@@ -335,7 +338,7 @@ export const TableEditor = ({
<DocsButton
abbrev={false}
className="mt-2"
- href={`${DOCS_URL}/guides/auth/row-level-security`}
+ href={`${DOCS_URL}${docsRowLevelSecurityGuidePath}`}
/>
</Admonition>
) : (
@@ -353,7 +356,7 @@ export const TableEditor = ({
<DocsButton
abbrev={false}
className="mt-2"
- href={`${DOCS_URL}/guides/auth/row-level-security`}
+ href={`${DOCS_URL}${docsRowLevelSecurityGuidePath}`}
/>
</Admonition>
)}
diff --git a/apps/studio/hooks/custom-content/CustomContent.types.ts b/apps/studio/hooks/custom-content/CustomContent.types.ts
index 4aa8b0216c8..b62e124743d 100644
--- a/apps/studio/hooks/custom-content/CustomContent.types.ts
+++ b/apps/studio/hooks/custom-content/CustomContent.types.ts
@@ -5,6 +5,8 @@ export type CustomContentTypes = {
dashboardAuthCustomProvider: string
+ docsRowLevelSecurityGuidePath: string
+
organizationLegalDocuments: {
id: string
name: string
diff --git a/apps/studio/hooks/custom-content/custom-content.json b/apps/studio/hooks/custom-content/custom-content.json
index 10dfa88265f..717ecb5852b 100644
--- a/apps/studio/hooks/custom-content/custom-content.json
+++ b/apps/studio/hooks/custom-content/custom-content.json
@@ -5,6 +5,8 @@
"dashboard_auth:custom_provider": null,
+ "docs:row_level_security_guide_path": "/guides/auth/row-level-security",
+
"organization:legal_documents": null,
"project_homepage:client_libraries": [
diff --git a/apps/studio/hooks/custom-content/custom-content.sample.json b/apps/studio/hooks/custom-content/custom-content.sample.json
index 943d5451273..6cc90b3f621 100644
--- a/apps/studio/hooks/custom-content/custom-content.sample.json
+++ b/apps/studio/hooks/custom-content/custom-content.sample.json
@@ -5,6 +5,8 @@
"dashboard_auth:custom_provider": "Nimbus",
+ "docs:row_level_security_guide_path": "/guides/database/postgres/row-level-security",
+
"organization:legal_documents": [
{
"id": "doc1",
diff --git a/apps/studio/hooks/custom-content/custom-content.schema.json b/apps/studio/hooks/custom-content/custom-content.schema.json
index 208c77c01fd..f6f80dd2722 100644
--- a/apps/studio/hooks/custom-content/custom-content.schema.json
+++ b/apps/studio/hooks/custom-content/custom-content.schema.json
@@ -16,6 +16,11 @@
"description": "Show a custom provider on the sign in page (Continue with X)"
},
+ "docs:row_level_security_guide_path": {
+ "type": ["string"],
+ "description": "The path to the row level security guide in the docs"
+ },
+
"organization:legal_documents": {
"type": ["array", "null"],
"description": "Renders a provided set of documents under the organization legal documents page",
@@ -91,6 +96,7 @@
},
"required": [
"app:title",
+ "docs:row_level_security_guide_path",
"organization:legal_documents",
"project_homepage:client_libraries",
"project_homepage:example_projects",