From 5f6232a7d92136a912714288e3737d22bbf53e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Catal=C3=A1n?= Date: Tue, 2 Jan 2024 20:41:15 -0500 Subject: [PATCH] feat: added support for Roles, Profiles and User Access Policies --- src/shared/metadata/file/classes/Definition.ts | 1 + src/shared/metadata/file/definitions/Role.ts | 5 +++-- src/shared/metadata/file/functions/index.ts | 1 + src/shared/metadata/file/functions/transformRole.ts | 4 ++++ src/shared/xlsx/index.ts | 5 ++++- src/shared/xlsx/tables/Roles.ts | 11 ++++++++++- src/shared/xlsx/tables/UserAccessPolicies.ts | 1 + 7 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/shared/metadata/file/functions/transformRole.ts diff --git a/src/shared/metadata/file/classes/Definition.ts b/src/shared/metadata/file/classes/Definition.ts index bb5c7ab..7c259c3 100644 --- a/src/shared/metadata/file/classes/Definition.ts +++ b/src/shared/metadata/file/classes/Definition.ts @@ -10,6 +10,7 @@ export interface Definition { readonly setName?: (record: Extended) => string; readonly setObjectname?: (record: Extended) => string; readonly setFullName?: (record: Extended) => string; + readonly setLabel?: (record: Extended) => string; readonly transform?: (record: Record) => void; readonly process?: Array<(record: Extended) => Array>>; readonly children?: Record; diff --git a/src/shared/metadata/file/definitions/Role.ts b/src/shared/metadata/file/definitions/Role.ts index 4a91039..62a289e 100644 --- a/src/shared/metadata/file/definitions/Role.ts +++ b/src/shared/metadata/file/definitions/Role.ts @@ -1,10 +1,11 @@ import { Role } from '../../types/metadata.js'; -import { Definition, getBasenameWithoutExtension } from '../index.js'; +import { Definition, getBasenameWithoutExtension, transformRole } from '../index.js'; export const ROLE: Definition = { name: 'Role', list: 'roles', extension: '.role-meta.xml', metadataType: {} as Role, - setName: getBasenameWithoutExtension, + setFullName: getBasenameWithoutExtension, + transform: transformRole, }; diff --git a/src/shared/metadata/file/functions/index.ts b/src/shared/metadata/file/functions/index.ts index 15fd071..982d34c 100644 --- a/src/shared/metadata/file/functions/index.ts +++ b/src/shared/metadata/file/functions/index.ts @@ -6,3 +6,4 @@ export * from './getNameOfSecondToLastFolderLevel.js'; export * from './splitBasename.js'; export * from './transformCustomTab.js'; export * from './transformFlow.js'; +export * from './transformRole.js'; diff --git a/src/shared/metadata/file/functions/transformRole.ts b/src/shared/metadata/file/functions/transformRole.ts new file mode 100644 index 0000000..169f711 --- /dev/null +++ b/src/shared/metadata/file/functions/transformRole.ts @@ -0,0 +1,4 @@ +export function transformRole(role: Record): void { + role.label = role.name; + role.name = role.fullName; +} diff --git a/src/shared/xlsx/index.ts b/src/shared/xlsx/index.ts index 2e6b86f..ee002eb 100644 --- a/src/shared/xlsx/index.ts +++ b/src/shared/xlsx/index.ts @@ -15,12 +15,15 @@ export const ALL_TABLES = [ Table.OBJECTS, Table.PERMISSION_SET_GROUPS, Table.PERMISSION_SETS, + Table.PROFILES, Table.QUICK_ACTIONS, Table.RECORD_TYPES, + Table.ROLES, Table.TABS, + Table.USER_ACCESS_POLICIES, Table.VALIDATION_RULES, Table.VISUALFORCE_COMPONENTS, Table.VISUALFORCE_PAGES, Table.WEBLINKS, - Table.WORKFLOW_RULES, + // Table.WORKFLOW_RULES, ]; diff --git a/src/shared/xlsx/tables/Roles.ts b/src/shared/xlsx/tables/Roles.ts index 830866e..70e7963 100644 --- a/src/shared/xlsx/tables/Roles.ts +++ b/src/shared/xlsx/tables/Roles.ts @@ -4,5 +4,14 @@ import { ROLE } from '../../metadata/file/index.js'; export const ROLES: Table = { name: 'Roles', definition: ROLE, - columns: [{ label: 'Name', field: 'name' }], + columns: [ + { label: 'Name', field: 'name' }, + { label: 'Label', field: 'label' }, + { label: 'Description', field: 'description' }, + { label: 'Parent Role', field: 'parentRole' }, + { label: 'Contact Access Level', field: 'contactAccessLevel' }, + { label: 'Opportunity Access Level', field: 'opportunityAccessLevel' }, + { label: 'Case Access Level', field: 'caseAccessLevel' }, + { label: 'May Forecast Manager Share', field: 'mayForecastManagerShare' }, + ], }; diff --git a/src/shared/xlsx/tables/UserAccessPolicies.ts b/src/shared/xlsx/tables/UserAccessPolicies.ts index 4f2ba21..50be7a9 100644 --- a/src/shared/xlsx/tables/UserAccessPolicies.ts +++ b/src/shared/xlsx/tables/UserAccessPolicies.ts @@ -7,5 +7,6 @@ export const USER_ACCESS_POLICIES: Table = { columns: [ { label: 'Name', field: 'name' }, { label: 'Label', field: 'masterLabel' }, + { label: 'Status', field: 'status' }, ], };