Skip to content

Commit

Permalink
feat: added support for Roles, Profiles and User Access Policies
Browse files Browse the repository at this point in the history
  • Loading branch information
catalandres committed Jan 3, 2024
1 parent 9bff9cc commit 5f6232a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/shared/metadata/file/classes/Definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface Definition {
readonly setName?: (record: Extended<Metadata>) => string;
readonly setObjectname?: (record: Extended<Metadata>) => string;
readonly setFullName?: (record: Extended<Metadata>) => string;
readonly setLabel?: (record: Extended<Metadata>) => string;
readonly transform?: (record: Record<string, unknown>) => void;
readonly process?: Array<(record: Extended<Metadata>) => Array<Extended<Metadata>>>;
readonly children?: Record<string, Definition>;
Expand Down
5 changes: 3 additions & 2 deletions src/shared/metadata/file/definitions/Role.ts
Original file line number Diff line number Diff line change
@@ -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,
};
1 change: 1 addition & 0 deletions src/shared/metadata/file/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './getNameOfSecondToLastFolderLevel.js';
export * from './splitBasename.js';
export * from './transformCustomTab.js';
export * from './transformFlow.js';
export * from './transformRole.js';
4 changes: 4 additions & 0 deletions src/shared/metadata/file/functions/transformRole.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export function transformRole(role: Record<string, unknown>): void {
role.label = role.name;
role.name = role.fullName;
}
5 changes: 4 additions & 1 deletion src/shared/xlsx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
11 changes: 10 additions & 1 deletion src/shared/xlsx/tables/Roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
};
1 change: 1 addition & 0 deletions src/shared/xlsx/tables/UserAccessPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const USER_ACCESS_POLICIES: Table = {
columns: [
{ label: 'Name', field: 'name' },
{ label: 'Label', field: 'masterLabel' },
{ label: 'Status', field: 'status' },
],
};

0 comments on commit 5f6232a

Please sign in to comment.