Code first roles sync (#13667)
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
import { type FlatRole } from 'src/engine/metadata-modules/flat-role/types/flat-role.type';
|
||||
import { type RoleEntity } from 'src/engine/metadata-modules/role/role.entity';
|
||||
|
||||
export const fromRoleEntityToFlatRole = (role: RoleEntity): FlatRole => {
|
||||
return {
|
||||
id: role.id,
|
||||
standardId: role.standardId,
|
||||
label: role.label,
|
||||
description: role.description,
|
||||
icon: role.icon,
|
||||
isEditable: role.isEditable,
|
||||
canUpdateAllSettings: role.canUpdateAllSettings,
|
||||
canAccessAllTools: role.canAccessAllTools,
|
||||
canReadAllObjectRecords: role.canReadAllObjectRecords,
|
||||
canUpdateAllObjectRecords: role.canUpdateAllObjectRecords,
|
||||
canSoftDeleteAllObjectRecords: role.canSoftDeleteAllObjectRecords,
|
||||
canDestroyAllObjectRecords: role.canDestroyAllObjectRecords,
|
||||
workspaceId: role.workspaceId,
|
||||
uniqueIdentifier: role.standardId || role.id,
|
||||
};
|
||||
};
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { type FlatRole } from 'src/engine/metadata-modules/flat-role/types/flat-role.type';
|
||||
import { type StandardRoleDefinition } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-roles/types/standard-role-definition.interface';
|
||||
|
||||
export const fromStandardRoleDefinitionToFlatRole = (
|
||||
standardRoleDefinition: StandardRoleDefinition,
|
||||
workspaceId: string,
|
||||
): FlatRole => {
|
||||
return {
|
||||
...standardRoleDefinition,
|
||||
id: v4(),
|
||||
workspaceId,
|
||||
uniqueIdentifier: standardRoleDefinition.standardId || v4(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user