[permissions] Move SettingsPermissions from twenty-shared to twenty-server (#10430)
This commit is contained in:
@ -4,8 +4,8 @@ import { Route, Routes } from 'react-router-dom';
|
||||
import { SettingsProtectedRouteWrapper } from '@/settings/components/SettingsProtectedRouteWrapper';
|
||||
import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { SettingsPermissions } from 'twenty-shared';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
import { SettingsPermissions } from '~/generated/graphql';
|
||||
|
||||
const SettingsAccountsCalendars = lazy(() =>
|
||||
import('~/pages/settings/accounts/SettingsAccountsCalendars').then(
|
||||
|
||||
@ -12,8 +12,9 @@ import { ViewType } from '@/views/types/ViewType';
|
||||
import { useCallback, useContext } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { isDefined, SettingsPermissions } from 'twenty-shared';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { IconEyeOff, IconSettings } from 'twenty-ui';
|
||||
import { SettingsPermissions } from '~/generated/graphql';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
|
||||
type UseRecordGroupActionsParams = {
|
||||
|
||||
@ -4,8 +4,12 @@ import { renderHook } from '@testing-library/react';
|
||||
import { ReactNode } from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { MutableSnapshot, RecoilRoot } from 'recoil';
|
||||
import { SettingsPermissions } from 'twenty-shared';
|
||||
import { Billing, FeatureFlagKey, OnboardingStatus } from '~/generated/graphql';
|
||||
import {
|
||||
Billing,
|
||||
FeatureFlagKey,
|
||||
OnboardingStatus,
|
||||
SettingsPermissions,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { billingState } from '@/client-config/states/billingState';
|
||||
@ -57,7 +61,7 @@ describe('useSettingsNavigationItems', () => {
|
||||
it('should hide workspace settings when no permissions', () => {
|
||||
(useSettingsPermissionMap as jest.Mock).mockImplementation(() => ({
|
||||
[SettingsPermissions.WORKSPACE]: false,
|
||||
[SettingsPermissions.WORKSPACE_USERS]: false,
|
||||
[SettingsPermissions.WORKSPACE_MEMBERS]: false,
|
||||
[SettingsPermissions.DATA_MODEL]: false,
|
||||
[SettingsPermissions.API_KEYS_AND_WEBHOOKS]: false,
|
||||
[SettingsPermissions.ROLES]: false,
|
||||
@ -78,7 +82,7 @@ describe('useSettingsNavigationItems', () => {
|
||||
it('should show workspace settings when has permissions', () => {
|
||||
(useSettingsPermissionMap as jest.Mock).mockImplementation(() => ({
|
||||
[SettingsPermissions.WORKSPACE]: true,
|
||||
[SettingsPermissions.WORKSPACE_USERS]: true,
|
||||
[SettingsPermissions.WORKSPACE_MEMBERS]: true,
|
||||
[SettingsPermissions.DATA_MODEL]: true,
|
||||
[SettingsPermissions.API_KEYS_AND_WEBHOOKS]: true,
|
||||
[SettingsPermissions.ROLES]: true,
|
||||
|
||||
@ -20,8 +20,8 @@ import {
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { SettingsPermissions } from 'twenty-shared';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
import { SettingsPermissions } from '~/generated/graphql';
|
||||
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { billingState } from '@/client-config/states/billingState';
|
||||
@ -111,7 +111,7 @@ const useSettingsNavigationItems = (): SettingsNavigationSection[] => {
|
||||
label: t`Members`,
|
||||
path: SettingsPath.WorkspaceMembersPage,
|
||||
Icon: IconUsers,
|
||||
isHidden: !permissionMap[SettingsPermissions.WORKSPACE_USERS],
|
||||
isHidden: !permissionMap[SettingsPermissions.WORKSPACE_MEMBERS],
|
||||
},
|
||||
{
|
||||
label: t`Billing`,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { SettingsPermissions } from 'twenty-shared';
|
||||
import { SettingsPermissions } from '~/generated/graphql';
|
||||
|
||||
export const useHasSettingsPermission = (
|
||||
settingsPermission?: SettingsPermissions,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { SettingsPermissions } from 'twenty-shared';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
import { SettingsPermissions } from '~/generated/graphql';
|
||||
import { buildRecordFromKeysWithSameValue } from '~/utils/array/buildRecordFromKeysWithSameValue';
|
||||
|
||||
export const useSettingsPermissionMap = (): Record<
|
||||
|
||||
Reference in New Issue
Block a user