Skip to content

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

Add a helper modal to explain roles and permissions

Joshen Lim770154976385
diff --git a/studio/components/interfaces/Organization/TeamSettings/MembersView.tsx b/studio/components/interfaces/Organization/TeamSettings/MembersView.tsx
index c54fae42643..a86e7cbd895 100644
--- a/studio/components/interfaces/Organization/TeamSettings/MembersView.tsx
+++ b/studio/components/interfaces/Organization/TeamSettings/MembersView.tsx
@@ -12,6 +12,7 @@ import { isInviteExpired, getUserDisplayName } from '../Organization.utils'
import Table from 'components/to-be-cleaned/Table'
import MemberActions from './MemberActions'
+import RolesHelperModal from './RolesHelperModal/RolesHelperModal'
import { PageContext } from 'pages/org/[slug]/settings'
import { getRolesManagementPermissions } from './TeamSettings.utils'
@@ -84,7 +85,10 @@ const MembersView = () => {
head={[
<Table.th key="header-user">User</Table.th>,
<Table.th key="header-status"></Table.th>,
- <Table.th key="header-role">Role</Table.th>,
+ <Table.th key="header-role" className="flex items-center space-x-2">
+ <span>Role</span>
+ <RolesHelperModal />
+ </Table.th>,
<Table.th key="header-action"></Table.th>,
]}
body={[
diff --git a/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.constants.ts b/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.constants.ts
new file mode 100644
index 00000000000..98f598f8b55
--- /dev/null
+++ b/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.constants.ts
@@ -0,0 +1,246 @@
+const ORGANIZATIONS_PERMISSIONS = {
+ title: 'Organization',
+ actions: [
+ {
+ description: 'Can change organization name',
+ permissions: {
+ owner: true,
+ admin: false,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can delete organization',
+ permissions: {
+ owner: true,
+ admin: false,
+ developer: false,
+ },
+ },
+ ],
+}
+
+const MEMBERS_MANAGEMENT_PERMISSIONS = {
+ title: 'Members',
+ actions: [
+ {
+ description: 'Can add an Owner',
+ permissions: {
+ owner: true,
+ admin: false,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can remove an Owner',
+ permissions: {
+ owner: true,
+ admin: false,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can add an Adminstrator',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can remove an Administrator',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can add a Developer',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can remove a Developer',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can revoke an invite',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can resend an invite',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ ],
+}
+
+const BILLING_PERMISSIONS = {
+ title: 'Billing',
+ actions: [
+ {
+ description: 'Can read invoices',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ {
+ description: 'Can read billing email',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ {
+ description: 'Can change billing email',
+ permissions: {
+ owner: true,
+ admin: false,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can view subscription',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ {
+ description: 'Can update subscription',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can read billing address',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ {
+ description: 'Can update billing address',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can read tax codes',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ {
+ description: 'Can update tax codes',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can read payment methods',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ {
+ description: 'Can update payment methods',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ ],
+}
+
+const PROJECT_PERMISSIONS = {
+ title: 'Projects',
+ actions: [
+ {
+ description: 'Can create a project',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can delete a project',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can update a project',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can pause a project',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can resume a project',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: false,
+ },
+ },
+ {
+ description: 'Can restart a project',
+ permissions: {
+ owner: true,
+ admin: true,
+ developer: true,
+ },
+ },
+ ],
+}
+
+export const PERMISSIONS_MAPPING = [
+ ORGANIZATIONS_PERMISSIONS,
+ MEMBERS_MANAGEMENT_PERMISSIONS,
+ BILLING_PERMISSIONS,
+ PROJECT_PERMISSIONS,
+]
diff --git a/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx b/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx
new file mode 100644
index 00000000000..a64efa0378c
--- /dev/null
+++ b/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx
@@ -0,0 +1,102 @@
+import { FC, Fragment, useState } from 'react'
+import { IconCheck, IconChevronDown, IconHelpCircle, Modal } from '@supabase/ui'
+import { PERMISSIONS_MAPPING } from './RolesHelperModal.constants'
+
+interface Props {}
+
+const RolesHelperModal: FC<Props> = ({}) => {
+ const [showModal, setShowModal] = useState(false)
+
+ // Left off here:
+ // "Permissions, Owner, Admin and Developer header to be sticky"
+ // Everything else scrollably y axis, fix the height, see if can get it out by tonight
+ // Also fix Modal component - the X icon is missing if closable
+
+ return (
+ <>
+ <IconHelpCircle
+ size={16}
+ strokeWidth={1.5}
+ className="cursor-pointer"
+ onClick={() => setShowModal(!showModal)}
+ />
+ <Modal
+ closable
+ hideFooter
+ visible={showModal}
+ size="xlarge"
+ header="Permissions for each role"
+ onCancel={() => setShowModal(!showModal)}
+ >
+ <div className="py-4 space-y-4">
+ <Modal.Content>
+ <p className="text-sm">
+ The following table shows the corresponding permissions for each available role in the
+ dashboard.
+ </p>
+ </Modal.Content>
+ <Modal.Content>
+ <div className="bg-scale-400 border border-scale-500 rounded">
+ <div className="flex items-center border-b border-scale-600">
+ <div className="text-sm w-[49%] pl-4">Permissions</div>
+ <div className="text-sm w-[17%] h-8 flex items-center justify-center border-l border-scale-600">
+ Owner
+ </div>
+ <div className="text-sm w-[17%] h-8 flex items-center justify-center border-l border-scale-600">
+ Adminstrator
+ </div>
+ <div className="text-sm w-[17%] h-8 flex items-center justify-center border-l border-scale-600">
+ Developer
+ </div>
+ </div>
+
+ <div className="max-h-[425px] overflow-y-auto">
+ {PERMISSIONS_MAPPING.map((group) => (
+ <Fragment key={group.title}>
+ <div className="flex items-center py-2 px-4 border-b border-scale-600 last:border-none">
+ <div className="text-sm w-[100%]">{group.title}</div>
+ </div>
+ {group.actions.map((action, idx) => (
+ <div
+ key={`${group.title}-${idx}`}
+ className="bg-scale-500 flex items-center border-b border-scale-600 last:border-none"
+ >
+ <div className="text-sm w-[49%] pl-4">{action.description}</div>
+ <div
+ className={[
+ 'h-8 text-center border-l border-scale-600',
+ 'text-sm w-[17%] flex items-center justify-center',
+ ].join(' ')}
+ >
+ {action.permissions.owner && <IconCheck size={14} strokeWidth={2} />}
+ </div>
+ <div
+ className={[
+ 'h-8 text-center border-l border-scale-600',
+ 'text-sm w-[17%] flex items-center justify-center',
+ ].join(' ')}
+ >
+ {action.permissions.admin && <IconCheck size={14} strokeWidth={2} />}
+ </div>
+ <div
+ className={[
+ 'h-8 text-center border-l border-scale-600',
+ 'text-sm w-[17%] flex items-center justify-center',
+ ].join(' ')}
+ >
+ {action.permissions.developer && <IconCheck size={14} strokeWidth={2} />}
+ </div>
+ </div>
+ ))}
+ </Fragment>
+ ))}
+ </div>
+ </div>
+ </Modal.Content>
+ </div>
+ </Modal>
+ </>
+ )
+}
+
+export default RolesHelperModal
diff --git a/studio/components/to-be-cleaned/Table.tsx b/studio/components/to-be-cleaned/Table.tsx
index f5c33fbb7a7..6e1c4c4d81a 100644
--- a/studio/components/to-be-cleaned/Table.tsx
+++ b/studio/components/to-be-cleaned/Table.tsx
@@ -48,7 +48,7 @@ const Th: React.FC<ThProps> = ({ children, className, style }) => {
if (className) classes.push(className)
return (
<th className={classes.join(' ')} style={style}>
- <Typography.Text type="secondary">{children}</Typography.Text>
+ {children}
</th>
)
}