CLSPreview.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { useParams } from 'common'
  2. import Image from 'next/image'
  3. import { Alert, AlertDescription, AlertTitle, WarningIcon } from 'ui'
  4. import { Markdown } from '@/components/interfaces/Markdown'
  5. import { InlineLink } from '@/components/ui/InlineLink'
  6. import { useCustomContent } from '@/hooks/custom-content/useCustomContent'
  7. import { BASE_PATH, DOCS_URL } from '@/lib/constants'
  8. export const CLSPreview = () => {
  9. const { ref } = useParams()
  10. const { docsRowLevelSecurityGuidePath } = useCustomContent(['docs:row_level_security_guide_path'])
  11. return (
  12. <div className="flex flex-col gap-2">
  13. <div className="mb-4 flex flex-col gap-y-2">
  14. <Markdown
  15. className="text-foreground-light max-w-full"
  16. content={`[Postgres Column-Level Privileges](${DOCS_URL}/guides/auth/column-level-security) is a feature of Postgres that allows you to grant or revoke privileges on tables and columns based on user roles.`}
  17. />
  18. <Markdown
  19. className="text-foreground-light max-w-full"
  20. 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}).`}
  21. />
  22. <Alert variant="warning" className="mt-2">
  23. <WarningIcon />
  24. <AlertTitle>
  25. Changes to column privileges will not be reflected in migrations when running{' '}
  26. <code className="text-code-inline">briven db diff</code>.
  27. </AlertTitle>
  28. <AlertDescription>
  29. Column privileges are not supported in the current version of the Briven CLI.
  30. <br />
  31. You will need to manually apply these changes to your database.
  32. </AlertDescription>
  33. </Alert>
  34. </div>
  35. <Image
  36. src={`${BASE_PATH}/img/previews/cls-preview.png`}
  37. width={1860}
  38. height={970}
  39. alt="api-docs-side-panel-preview"
  40. className="rounded-sm border"
  41. />
  42. <div className="space-y-2 mt-4!">
  43. <p className="text-sm">Enabling this preview will:</p>
  44. <ul className="list-disc pl-6 text-sm text-foreground-light space-y-1">
  45. <li>
  46. Grant access to a new UI for granting and/or revoking column-level privileges{' '}
  47. <InlineLink href={`/project/${ref}/database/column-privileges`}>here</InlineLink>.
  48. </li>
  49. </ul>
  50. </div>
  51. </div>
  52. )
  53. }