Skip to content

Commit

Permalink
Fix login identifier mapping issues.Added enrollment flow transmogrif…
Browse files Browse the repository at this point in the history
…ication.
  • Loading branch information
Ioannis committed Nov 18, 2025
1 parent 122be9b commit eea3fb0
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 8 deletions.
60 changes: 58 additions & 2 deletions app/plugins/Transmogrify/config/schema/tables.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"postRow": "mapExternalIdentityToExternalIdentityRole",
"fieldMap": {
"co_id": null,
"person_id": "&mapOrgIdentitycoPersonId",
"person_id": "&mapOrgIdentityCoPersonId",
"org_identity_id": "external_identity_id",
"title": null,
"o": null,
Expand Down Expand Up @@ -433,12 +433,68 @@
"org_identity_id": "external_identity_id"
}
},
"enrollment_flows": {
"source": "cm_co_enrollment_flows",
"displayField": "name",
"booleans": [
"collect_enrollee_email"
],
"cache": ["co_id", "auth_cou_id", "authz_co_group_id"],
"postRow": null,
"fieldMap": {
"authz_level": "authz_type",
"authz_co_group_id": "authz_group_id",
"my_identity_shortcut": null,
"match_policy": null,
"match_server_id": null,
"enable_person_find": null,
"approval_required": null,
"approver_co_group_id": null,
"approval_confirmation_mode": null,
"approval_require_comment": null,
"verify_email": null,
"email_verification_mode": null,
"invitation_validity": null,
"regenerate_expired_verification": null,
"require_authn": null,
"notification_co_group_id": "notification_group_id",
"status": "=S",
"notify_from": null,
"verification_subject": null,
"verification_body": null,
"verification_template_id": null,
"request_vetting": null,
"notify_on_approval": null,
"approval_subject": null,
"approval_body": null,
"approval_template_id": "notification_message_template_id",
"approver_template_id": null,
"denial_template_id": null,
"notify_on_finalize": null,
"finalization_template_id": "finalization_message_template_id",
"introduction_text": null,
"conclusion_text": null,
"introduction_text_pa": null,
"t_and_c_mode": null,
"redirect_on_submit": null,
"redirect_on_confirm": null,
"redirect_on_finalize": "redirect_on_finalize",
"return_url_allowlist": null,
"ignore_authoritative": null,
"duplicate_mode": null,
"co_theme_id": null,
"theme_stacking": null,
"establish_authenticators": null,
"establish_cluster_accounts": null,
"co_enrollment_flow_id": "enrollment_flow_id"
}
},
"petitions": {
"source": "cm_co_petitions",
"displayField": "authenticated_identifier",
"canSkip": "true",
"fieldMap": {
"co_enrollment_flow_id": null,
"co_enrollment_flow_id": "enrollment_flow_id",
"co_id": null,
"cou_id": "cou_id",
"status": "&mapPetitionStatus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ protected function mapLegacyFieldNames(string $table, array &$row): void
// Default value mapping: set only if current value is null
$first === '?' => $this->applyDefaultIfNull($row, $oldname, substr((string)$newname, 1)),

// Default value mapping: force set the value to the current value
$first === '=' => $row[$oldname] = substr((string)$newname, 1),

// Direct rename: copy to new name and unset the old one
default => $this->renameField($row, $oldname, (string)$newname),
};
Expand Down Expand Up @@ -352,7 +355,7 @@ protected function mapExternalIdentityToExternalIdentityRole(array $origRow, arr
$roleRow[$newKey] = $origRow[$oldKey];
}

// Rationale: mapOrgIdentitycoPersonId accepts only the first mapping it finds
// Rationale: mapOrgIdentityCoPersonId accepts only the first mapping it finds
// (later mappings are treated as legacy/unpooled anomalies and ignored).
// Therefore, each ExternalIdentity produces at most one ExternalIdentityRole.
// To avoid inserting a bogus self-referential changelog link, do not carry any
Expand Down
10 changes: 5 additions & 5 deletions app/plugins/Transmogrify/src/Lib/Traits/TypeMapperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,18 @@ protected function mapLoginIdentifiers(array $origRow, array &$row): void {
// (ie: $row) untouched

$copiedRow = [
'person_id' => $this->map_org_identity_co_person_id(['id' => $origRow['org_identity_id']]),
'person_id' => $this->mapOrgIdentityCoPersonId(['id' => $origRow['org_identity_id']]),
'identifier' => $origRow['identifier'],
'type_id' => $this->map_identifier_type($origRow),
'type_id' => $this->mapIdentifierType($origRow),
'status' => $origRow['status'],
'login' => true,
'created' => $origRow['created'],
'modified' => $origRow['modified']
];

// Set up changelog and fix booleans
$this->fixChangelog('identifiers', $copiedRow, true);
$this->fixBooleans('identifiers', $copiedRow);
$this->populateChangelogDefaults('identifiers', $copiedRow, true);
$this->normalizeBooleanFieldsForDb('identifiers', $copiedRow);

try {
$tableName = 'identifiers';
Expand Down Expand Up @@ -325,7 +325,7 @@ protected function mapNow(array $row) {
* @throws Exception
* @since COmanage Registry v5.0.0
*/
protected function mapOrgIdentitycoPersonId(array $row): ?int
protected function mapOrgIdentityCoPersonId(array $row): ?int
{
// PE eliminates OrgIdentityLink, so we need to map each Org Identity to
// a Person ID. Historically, an Org Identity could have been relinked and
Expand Down

0 comments on commit eea3fb0

Please sign in to comment.