The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Role permissions tab should display object permissions from API result (#10344)
Weiko65bd1d7775e3
diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsxindex e5deadd858a..2626d2bfce4 100644--- a/packages/twenty-front/src/generated/graphql.tsx+++ b/packages/twenty-front/src/generated/graphql.tsx@@ -2321,7 +2321,7 @@ export type UpdateLabPublicFeatureFlagMutationVariables = Exact<{export type UpdateLabPublicFeatureFlagMutation = { __typename?: 'Mutation', updateLabPublicFeatureFlag: { __typename?: 'FeatureFlag', id: any, key: FeatureFlagKey, value: boolean } };-export type RoleFragmentFragment = { __typename?: 'Role', id: string, label: string, description?: string | null, canUpdateAllSettings: boolean, isEditable: boolean };+export type RoleFragmentFragment = { __typename?: 'Role', id: string, label: string, description?: string | null, canUpdateAllSettings: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean };export type UpdateWorkspaceMemberRoleMutationVariables = Exact<{workspaceMemberId: Scalars['String'];@@ -2329,12 +2329,12 @@ export type UpdateWorkspaceMemberRoleMutationVariables = Exact<{}>;-export type UpdateWorkspaceMemberRoleMutation = { __typename?: 'Mutation', updateWorkspaceMemberRole: { __typename?: 'WorkspaceMember', id: any, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, roles?: Array<{ __typename?: 'Role', id: string, label: string, description?: string | null, canUpdateAllSettings: boolean, isEditable: boolean }> | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } };+export type UpdateWorkspaceMemberRoleMutation = { __typename?: 'Mutation', updateWorkspaceMemberRole: { __typename?: 'WorkspaceMember', id: any, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, roles?: Array<{ __typename?: 'Role', id: string, label: string, description?: string | null, canUpdateAllSettings: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean }> | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } };export type GetRolesQueryVariables = Exact<{ [key: string]: never; }>;-export type GetRolesQuery = { __typename?: 'Query', getRoles: Array<{ __typename?: 'Role', id: string, label: string, description?: string | null, canUpdateAllSettings: boolean, isEditable: boolean, workspaceMembers: Array<{ __typename?: 'WorkspaceMember', id: any, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> }> };+export type GetRolesQuery = { __typename?: 'Query', getRoles: Array<{ __typename?: 'Role', id: string, label: string, description?: string | null, canUpdateAllSettings: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, workspaceMembers: Array<{ __typename?: 'WorkspaceMember', id: any, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> }> };export type CreateOidcIdentityProviderMutationVariables = Exact<{input: SetupOidcSsoInput;@@ -2616,6 +2616,10 @@ export const RoleFragmentFragmentDoc = gql`descriptioncanUpdateAllSettingsisEditable+ canReadAllObjectRecords+ canUpdateAllObjectRecords+ canSoftDeleteAllObjectRecords+ canDestroyAllObjectRecords}`;export const WorkspaceMemberQueryFragmentFragmentDoc = gql`diff --git a/packages/twenty-front/src/modules/settings/roles/graphql/fragments/roleFragment.ts b/packages/twenty-front/src/modules/settings/roles/graphql/fragments/roleFragment.tsindex 17c90f40d5e..d99ed678869 100644--- a/packages/twenty-front/src/modules/settings/roles/graphql/fragments/roleFragment.ts+++ b/packages/twenty-front/src/modules/settings/roles/graphql/fragments/roleFragment.ts@@ -7,5 +7,9 @@ export const ROLE_FRAGMENT = gql`descriptioncanUpdateAllSettingsisEditable+ canReadAllObjectRecords+ canUpdateAllObjectRecords+ canSoftDeleteAllObjectRecords+ canDestroyAllObjectRecords}`;diff --git a/packages/twenty-front/src/pages/settings/roles/components/RolePermissions.tsx b/packages/twenty-front/src/pages/settings/roles/components/RolePermissions.tsxindex 25b70f2c576..7462563191c 100644--- a/packages/twenty-front/src/pages/settings/roles/components/RolePermissions.tsx+++ b/packages/twenty-front/src/pages/settings/roles/components/RolePermissions.tsx@@ -22,7 +22,15 @@ const StyledRolePermissionsContainer = styled.div``;type RolePermissionsProps = {- role: Pick<Role, 'id' | 'canUpdateAllSettings'>;+ role: Pick<+ Role,+ | 'id'+ | 'canUpdateAllSettings'+ | 'canReadAllObjectRecords'+ | 'canUpdateAllObjectRecords'+ | 'canSoftDeleteAllObjectRecords'+ | 'canDestroyAllObjectRecords'+ >;};export const RolePermissions = ({ role }: RolePermissionsProps) => {@@ -31,25 +39,25 @@ export const RolePermissions = ({ role }: RolePermissionsProps) => {key: 'seeRecords',label: 'See Records on All Objects',icon: <IconEye size={14} />,- value: true,+ value: role.canReadAllObjectRecords,},{key: 'editRecords',label: 'Edit Records on All Objects',icon: <IconPencil size={14} />,- value: true,+ value: role.canUpdateAllObjectRecords,},{key: 'deleteRecords',label: 'Delete Records on All Objects',icon: <IconTrash size={14} />,- value: true,+ value: role.canSoftDeleteAllObjectRecords,},{key: 'destroyRecords',label: 'Destroy Records on All Objects',icon: <IconTrashX size={14} />,- value: true,+ value: role.canDestroyAllObjectRecords,},];