Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { type FC } from 'react';
import { Stack, Text, Checkbox, Table, Flex, Box } from '@contentful/f36-components';
import type { ContentLifecyclePermissions } from '../types/config';
import type { ContentLifecycleEntityKey, EntityActionKey } from '../types/config';

interface ContentLifecyclePermissionsTableProps {
permissions: ContentLifecyclePermissions;
onSelectAllToggle: () => void;
onEntityActionToggle: (entity: 'entries' | 'assets' | 'contentTypes', action: string) => void;
onColumnToggle: (action: string) => void;
onRowToggle: (entity: 'entries' | 'assets' | 'contentTypes') => void;
onEntityActionToggle: (entity: ContentLifecycleEntityKey, action: EntityActionKey) => void;
onColumnToggle: (action: EntityActionKey) => void;
onRowToggle: (entity: ContentLifecycleEntityKey) => void;
}

export const ContentLifecyclePermissionsTable: FC<ContentLifecyclePermissionsTableProps> = ({
Expand Down Expand Up @@ -58,7 +59,7 @@ export const ContentLifecyclePermissionsTable: FC<ContentLifecyclePermissionsTab
permissions.assets[action as keyof typeof permissions.assets] &&
permissions.contentTypes[action as keyof typeof permissions.contentTypes]
}
onChange={() => onColumnToggle(action)}
onChange={() => onColumnToggle(action as EntityActionKey)}
/>
</Flex>
</Table.Cell>
Expand Down Expand Up @@ -91,7 +92,7 @@ export const ContentLifecyclePermissionsTable: FC<ContentLifecyclePermissionsTab
<Flex justifyContent="center">
<Checkbox
isChecked={permissions[entity][action as keyof typeof permissions.entries]}
onChange={() => onEntityActionToggle(entity, action)}
onChange={() => onEntityActionToggle(entity, action as EntityActionKey)}
/>
</Flex>
</Table.Cell>
Expand Down
43 changes: 28 additions & 15 deletions apps/remote-mcp/src/components/types/config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
export interface EntityPermissions {
read: boolean;
edit: boolean;
create: boolean;
delete: boolean;
publish: boolean;
unpublish: boolean;
archive: boolean;
unarchive: boolean;
edit?: boolean;
create?: boolean;
delete?: boolean;
publish?: boolean;
unpublish?: boolean;
archive?: boolean;
unarchive?: boolean;
invoke?: boolean;
}

export interface ContentLifecyclePermissions {
selectAll: boolean;
entries: EntityPermissions;
assets: EntityPermissions;
contentTypes: EntityPermissions;
aiActions: EntityPermissions;
editorInterfaces: EntityPermissions;
environments: EntityPermissions;
locales: EntityPermissions;
orgs: EntityPermissions;
spaces: EntityPermissions;
tags: EntityPermissions;
concepts: EntityPermissions;
conceptSchemes: EntityPermissions;
}

export interface OtherFeaturesPermissions {
runAIActions: boolean;
triggerAutomations: boolean;
installApps: boolean;
callAppActions: boolean;
invokeAgents: boolean;
}

export interface MigrationPermissions {
Expand All @@ -40,14 +46,21 @@ export interface AppInstallationParameters {
entries: string;
assets: string;
contentTypes: string;
aiActions: string;
editorInterfaces: string;
environments: string;
locales: string;
orgs: string;
spaces: string;
tags: string;
concepts: string;
conceptSchemes: string;
runAIActions: boolean;
triggerAutomations: boolean;
installApps: boolean;
callAppActions: boolean;
invokeAgents: boolean;
migrateWithinSpace: boolean;
migrateBetweenSpaces: boolean;
}

export type OtherFeaturesPermissionKey = keyof OtherFeaturesPermissions;
export type MigrationPermissionKey = keyof MigrationPermissions;
export type ContentLifecycleEntityKey = Exclude<keyof ContentLifecyclePermissions, 'selectAll'>;
export type EntityActionKey = keyof EntityPermissions;