Skip to content

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

Replace permissions matrix with links to docs (#27891)

Joshen Lim5e2c374a4e79
diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/RolesAccessMatrix.constants.ts b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/RolesAccessMatrix.constants.ts
deleted file mode 100644
index 23ab8dc132a..00000000000
--- a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/RolesAccessMatrix.constants.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-// [Joshen] Directly from supabase/apps/docs/content/guides/platform/access-control.mdx
-// We could put this into shared-data repository to ensure www and dashboard stays in sync
-
-export const ROLES_ACCESS_MARKDOWN = `
-| Permissions | Owner | Administrator | Developer | Read only [^1] |
-| ------------------------ | --------------| --------------- | ----------| ----------|
-| **Organization** |
-| Change organization name | ✓ | | | |
-| Delete organization | ✓ | | | |
-| **Members** |
-| Add an Owner | ✓ | | | |
-| Remove an Owner | ✓ | | | |
-| Add an Administrator | ✓ | ✓ | | |
-| Remove an Administrator | ✓ | ✓ | | |
-| Add a Developer | ✓ | ✓ | | |
-| Remove a Developer | ✓ | ✓ | | |
-| Revoke an invite | ✓ | ✓ | | |
-| Resend an invite | ✓ | ✓ | | |
-| Accept an invite [^2] | ✓ | ✓ | ✓ |
-| **Billing** |
-| Read invoices | ✓ | ✓ | ✓ | |
-| Read billing email | ✓ | ✓ | ✓ | |
-| Change billing email | ✓ | | | |
-| View subscription | ✓ | ✓ | ✓ | |
-| Update subscription | ✓ | ✓ | | |
-| Read billing address | ✓ | ✓ | ✓ | |
-| Update billing address | ✓ | ✓ | | |
-| Read tax codes | ✓ | ✓ | ✓ | |
-| Update tax codes | ✓ | ✓ | | |
-| Read payment methods | ✓ | ✓ | ✓ | |
-| Update payment methods | ✓ | ✓ | | |
-| **Projects** |
-| Create a project | ✓ | ✓ | | |
-| Delete a project | ✓ | ✓ | | |
-| Update a project | ✓ | ✓ | | |
-| Pause a project | ✓ | ✓ | | |
-| Resume a project | ✓ | ✓ | | |
-| Restart a project | ✓ | ✓ | ✓ | |
-| Manage tables | ✓ | ✓ | ✓ | |
-| View Data | ✓ | ✓ | ✓ | ✓[^3] |
-`.trim()
diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/RolesAccessMatrix.tsx b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/RolesAccessMatrix.tsx
deleted file mode 100644
index 705fa4bcb55..00000000000
--- a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/RolesAccessMatrix.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { Markdown } from 'components/interfaces/Markdown'
-import Table from 'components/to-be-cleaned/Table'
-import { ExternalLink } from 'lucide-react'
-import { Button, SheetHeader, cn } from 'ui'
-import { ROLES_ACCESS_MARKDOWN } from './RolesAccessMatrix.constants'
-
-interface RolesAccessMatrixProps {
- visible: boolean
-}
-
-// [Joshen] TODO We'll need to update this for project level permissions too
-export const RolesAccessMatrix = ({ visible }: RolesAccessMatrixProps) => {
- return (
- <div
- className={cn(
- 'flex flex-col border-l shadow-[rgba(0,0,0,0.13)_-4px_0px_6px_0px] z-10 bg-studio',
- visible && 'w-[52%]'
- )}
- >
- <SheetHeader className="flex items-center justify-between py-3 border-b">
- <p>Permissions across roles</p>
- <Button asChild type="default" icon={<ExternalLink size={14} />}>
- <a
- href="https://supabase.com/docs/guides/platform/access-control"
- target="_blank"
- rel="noreferrer"
- >
- Documentation
- </a>
- </Button>
- </SheetHeader>
-
- <div className="flex flex-col flex-grow gap-y-4 px-5 py-5 overflow-y-auto">
- <p className="text-sm text-foreground-light">
- The table below shows the corresponding permissions for each available role you can assign
- a team member in the Dashboard.
- </p>
- <Markdown
- content={ROLES_ACCESS_MARKDOWN}
- className="max-w-full [&>table>thead>tr>th:not(:first-child)]:text-center [&>table>tbody>tr>td:not(:first-child)]:text-center"
- components={{
- th: ({ children }) => {
- if (children?.[0] && typeof children[0] === 'string' && children[0].includes('[^')) {
- const text = children[0].split('[^')
- const number = text?.[1]?.[0] ?? undefined
- return (
- <th>
- {text[0]}
- {number !== undefined && (
- <sup
- tabIndex={Number(number)}
- className="ml-0.5 text-foreground cursor-pointer underline"
- onClick={() => {
- const el = document.getElementById(`roles-helper-${number}`)
- if (el !== undefined)
- el?.scrollIntoView({ behavior: 'smooth', block: 'center' })
- }}
- >
- {number}
- </sup>
- )}
- </th>
- )
- } else {
- return <th>{children?.[0]}</th>
- }
- },
- td: ({ children }) => {
- if (children?.[0] && typeof children[0] === 'string' && children[0].includes('[^')) {
- const text = children[0].split('[^')
- const number = text?.[1]?.[0] ?? undefined
- return (
- <td>
- {text[0]}
- {number !== undefined && (
- <sup
- tabIndex={Number(number)}
- className="ml-0.5 text-foreground cursor-pointer underline"
- onClick={() => {
- const el = document.getElementById(`roles-helper-${number}`)
- if (el !== undefined)
- el?.scrollIntoView({ behavior: 'smooth', block: 'center' })
- }}
- >
- {number}
- </sup>
- )}
- </td>
- )
- } else {
- return <td>{children?.[0]}</td>
- }
- },
- }}
- />
-
- <div className="flex flex-col gap-y-2">
- <p className="text-sm">Footnotes</p>
- <ol className="list-decimal pl-6 text-xs flex flex-col gap-y-2">
- <li id="roles-helper-1">Available on the Teams and Enterprise Plans.</li>
- <li id="roles-helper-2">
- Invites sent from a SSO account can only be accepted by another SSO account coming
- from the same identity provider. This is a security measure that prevents accidental
- invites to accounts not managed by your company's enterprise systems
- </li>
- <li id="roles-helper-3">
- <Markdown
- className="text-xs text-foreground"
- content="Only available on projects using PostgreSQL 14 and above. You can upgrade your project through [infrastructure settings](https://supabase.com/dashboard/project/_/settings/infrastructure)."
- />
- </li>
- </ol>
- </div>
- </div>
- </div>
- )
-}
diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanel.tsx b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanel.tsx
index 676aa170bd9..bae6f530747 100644
--- a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanel.tsx
+++ b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanel.tsx
@@ -1,5 +1,5 @@
import { isEqual } from 'lodash'
-import { PanelLeftClose, PanelRightClose, X } from 'lucide-react'
+import { ExternalLink, X } from 'lucide-react'
import { useEffect, useState } from 'react'
import { useParams } from 'common'
@@ -43,7 +43,6 @@ import {
} from 'ui'
import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
import { useGetRolesManagementPermissions } from '../TeamSettings.utils'
-import { RolesAccessMatrix } from './RolesAccessMatrix'
import { UpdateRolesConfirmationModal } from './UpdateRolesConfirmationModal'
import {
ProjectRoleConfiguration,
@@ -80,7 +79,6 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
const [showConfirmation, setShowConfirmation] = useState(false)
const [showProjectDropdown, setShowProjectDropdown] = useState(false)
- const [showRolesAccessMatrix, setShowRolesAccessMatrix] = useState(false)
const [projectsRoleConfiguration, setProjectsRoleConfiguration] = useState<
ProjectRoleConfiguration[]
>([])
@@ -157,8 +155,6 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
projects ?? []
)
setProjectsRoleConfiguration(roleConfiguration)
- } else {
- setShowRolesAccessMatrix(false)
}
}, [visible, isSuccessRoles])
@@ -167,32 +163,25 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
<Sheet open={visible} onOpenChange={() => onClose()}>
<SheetContent
showClose={false}
- size={showRolesAccessMatrix ? 'lg' : 'default'}
- className={cn(
- 'bg-surface-200 p-0 flex flex-row gap-0',
- showRolesAccessMatrix ? '!min-w-[1000px]' : '!min-w-[400px]'
- )}
+ size="default"
+ className={cn('bg-surface-200 p-0 flex flex-row gap-0 !min-w-[400px]')}
>
- <div className={cn('flex flex-col grow', showRolesAccessMatrix ? 'w-[48%]' : 'w-full')}>
+ <div className={cn('flex flex-col grow w-full')}>
<SheetHeader
className={cn('py-3 flex flex-row justify-between gap-x-4 items-center border-b')}
>
<p className="truncate" title={`Manage access for ${member.username}`}>
Manage access for {member.username}
</p>
- <Tooltip_Shadcn_ delayDuration={100}>
- <TooltipTrigger_Shadcn_ asChild>
- <Button
- type="outline"
- className="[&>div]:text-foreground-light px-1.5"
- icon={!showRolesAccessMatrix ? <PanelLeftClose /> : <PanelRightClose />}
- onClick={() => setShowRolesAccessMatrix(!showRolesAccessMatrix)}
- />
- </TooltipTrigger_Shadcn_>
- <TooltipContent_Shadcn_ side="left">
- {showRolesAccessMatrix ? 'Hide' : 'Show'} role permissions
- </TooltipContent_Shadcn_>
- </Tooltip_Shadcn_>
+ <Button asChild type="default" icon={<ExternalLink />}>
+ <a
+ target="_blank"
+ rel="noreferrer"
+ href="https://supabase.com/docs/guides/platform/access-control"
+ >
+ Documentation
+ </a>
+ </Button>
</SheetHeader>
<SheetSection className="h-full overflow-auto flex flex-col gap-y-4">
@@ -399,8 +388,6 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
</Button>
</SheetFooter>
</div>
-
- {showRolesAccessMatrix && <RolesAccessMatrix visible={showRolesAccessMatrix} />}
</SheetContent>
</Sheet>
diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanelOld.tsx b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanelOld.tsx
index 45ee21f9e90..47b5cfdb2fa 100644
--- a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanelOld.tsx
+++ b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanelOld.tsx
@@ -1,4 +1,4 @@
-import { PanelLeftClose, PanelRightClose } from 'lucide-react'
+import { ExternalLink } from 'lucide-react'
import { useEffect, useState } from 'react'
import { useParams } from 'common'
@@ -20,14 +20,10 @@ import {
SheetContent,
SheetFooter,
SheetHeader,
- TooltipContent_Shadcn_,
- TooltipTrigger_Shadcn_,
- Tooltip_Shadcn_,
cn,
} from 'ui'
import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
import { MultiSelectV2 } from 'ui-patterns/MultiSelectDeprecated/MultiSelectV2'
-import { RolesAccessMatrix } from './RolesAccessMatrix'
interface UpdateRolesPanelProps {
visible: boolean
@@ -44,7 +40,6 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
const { data } = useOrganizationRolesQuery({ slug })
const { data: projects } = useProjectsQuery()
- const [showRolesAccessMatrix, setShowRolesAccessMatrix] = useState(false)
const [roleConfiguration, setRoleConfiguration] = useState<
{ id: number; name: string; projects: string[] }[]
>([])
@@ -101,8 +96,6 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
return { ...role, projects: [] }
})
)
- } else {
- setShowRolesAccessMatrix(false)
}
}, [visible])
@@ -110,37 +103,21 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
<Sheet open={visible} onOpenChange={() => onClose()}>
<SheetContent
showClose={false}
- size={showRolesAccessMatrix ? 'lg' : 'default'}
- className={cn(
- 'bg-surface-200 p-0 flex flex-row gap-0',
- showRolesAccessMatrix ? '!min-w-[1000px]' : '!min-w-[400px]'
- )}
+ size="default"
+ className={cn('bg-surface-200 p-0 flex flex-row gap-0 !min-w-[400px]')}
>
- <div className={cn('flex flex-col grow', showRolesAccessMatrix ? 'w-[48%]' : 'w-full')}>
+ <div className={cn('flex flex-col grow w-full')}>
<SheetHeader className={cn('py-3 flex flex-row justify-between items-center border-b')}>
<p>Manage access for team member</p>
- <Tooltip_Shadcn_ delayDuration={100}>
- <TooltipTrigger_Shadcn_ asChild>
- <button
- aria-expanded={showRolesAccessMatrix}
- aria-controls="show-roles-matrix"
- className={cn(
- !showRolesAccessMatrix ? 'text-foreground-lighter' : 'text-light',
- 'mt-1 hover:text-foreground transition'
- )}
- onClick={() => setShowRolesAccessMatrix(!showRolesAccessMatrix)}
- >
- {!showRolesAccessMatrix ? (
- <PanelLeftClose size={19} strokeWidth={1} />
- ) : (
- <PanelRightClose size={19} strokeWidth={1} />
- )}
- </button>
- </TooltipTrigger_Shadcn_>
- <TooltipContent_Shadcn_ side="left">
- {showRolesAccessMatrix ? 'Hide' : 'Show'} role permissions
- </TooltipContent_Shadcn_>
- </Tooltip_Shadcn_>
+ <Button asChild type="default" icon={<ExternalLink />}>
+ <a
+ target="_blank"
+ rel="noreferrer"
+ href="https://supabase.com/docs/guides/platform/access-control"
+ >
+ Documentation
+ </a>
+ </Button>
</SheetHeader>
<div className="h-full flex flex-col gap-y-4 px-5 py-5">
@@ -249,7 +226,6 @@ export const UpdateRolesPanel = ({ visible, member, onClose }: UpdateRolesPanelP
</Button>
</SheetFooter>
</div>
- {showRolesAccessMatrix && <RolesAccessMatrix visible={showRolesAccessMatrix} />}
</SheetContent>
</Sheet>
)
diff --git a/apps/studio/next-env.d.ts b/apps/studio/next-env.d.ts
index fd36f9494e2..4f11a03dc6c 100644
--- a/apps/studio/next-env.d.ts
+++ b/apps/studio/next-env.d.ts
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.