Skip to content

Commit

Permalink
Initial commit of record cloning (CFM-127)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Oct 28, 2025
1 parent c6dcc74 commit 8e0b5ab
Show file tree
Hide file tree
Showing 44 changed files with 2,081 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ public function localAfterSave(\Cake\Event\EventInterface $event, \Cake\Datasour

// Also, When the SQL Provisioner is deleted, neither the
// database schema nor reference data is touched (PAR-SqlProvisioner-4).
if(!empty($entity->server_id) && !$entity->deleted) {
// Similarly, we skip this when cloning.
if(!empty($entity->server_id) && !$entity->deleted
&& (!isset($options['clone']) || !$options['clone'])) {
// Apply the database schema (PAR-SqlProvisioner-1)
$this->llog('rule', "PAR-SqlProvisioner-1 Applying database schema for SqlProvisioner " . $entity->id);
$this->applySchema($entity->id);
Expand Down Expand Up @@ -572,7 +574,7 @@ public function syncReferenceData(int $id, string $dataSource='targetdb') {

$options = [
'table' => $spcfg->table_prefix . $m['table'],
'alias' => $m['name'] . $SqlProvisioner->id,
'alias' => $m['name'] . $id,
'connection' => ConnectionManager::get($dataSource)
];

Expand Down
23 changes: 16 additions & 7 deletions app/config/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"types_i1": { "columns": [ "co_id" ] },
"types_i2": { "columns": [ "co_id", "attribute" ] },
"types_i3": { "columns": [ "co_id", "attribute", "value" ] }
}
},
"clonable": true
},

"servers": {
Expand All @@ -116,7 +117,8 @@
},
"indexes": {
"servers_i1": { "columns": [ "co_id" ] }
}
},
"clonable": true
},

"co_settings": {
Expand Down Expand Up @@ -195,7 +197,8 @@
"indexes": {
"api_users_i1": { "columns": [ "co_id" ] },
"api_users_i2": { "columns": [ "username" ] }
}
},
"clonable": true
},

"cous": {
Expand All @@ -210,6 +213,7 @@
"cous_i2": { "columns": [ "name" ] },
"cous_i3": { "columns": [ "co_id", "name" ] }
},
"clonable": true,
"tree": true
},

Expand Down Expand Up @@ -323,6 +327,7 @@
"groups_i5": { "needed": false, "columns": [ "cou_id" ]},
"groups_i6": { "needed": false, "columns": [ "owners_group_id" ]}
},
"clonable": true,
"tree": true
},

Expand Down Expand Up @@ -443,7 +448,8 @@
"indexes": {
"provisioning_targets_i1": { "columns": [ "co_id" ]},
"provisioning_targets_i2": { "needed": false, "columns": [ "provisioning_group_id" ] }
}
},
"clonable": true
},

"provisioning_history_records": {
Expand Down Expand Up @@ -812,7 +818,8 @@
"identifier_assignments_i1": { "columns": [ "co_id" ] },
"identifier_assignments_i2": { "needed": false, "columns": [ "email_address_type_id" ] },
"identifier_assignments_i3": { "needed": false, "columns": [ "identifier_type_id" ] }
}
},
"clonable": true
},

"pipelines": {
Expand Down Expand Up @@ -841,7 +848,8 @@
"pipelines_i6": { "needed": false, "columns": [ "sync_replace_cou_id" ] },
"pipelines_i7": { "needed": false, "columns": [ "sync_identifier_type_id" ] },
"pipelines_i8": { "needed": false, "columns": [ "match_identifier_type_id" ] }
}
},
"clonable": true
},

"flanges": {
Expand Down Expand Up @@ -877,7 +885,8 @@
"external_identity_sources_i1": { "columns": [ "co_id" ] },
"external_identity_sources_i2": { "columns": [ "sor_label"] },
"external_identity_sources_i3": { "needed": false, "columns": [ "pipeline_id" ] }
}
},
"clonable": true
},

"ext_identity_source_records": {
Expand Down
21 changes: 21 additions & 0 deletions app/resources/locales/en_US/command.po
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ msgstr "Given Name of initial platform administrator"
msgid "opt.admin-username"
msgstr "Username of initial platform administrator"

msgid "opt.clone.all"
msgstr "Clone all available objects"

msgid "opt.clone.co_id"
msgstr "Source CO ID"

msgid "opt.clone.cri"
msgstr "Clone all available objects with the specified CRI"

msgid "opt.clone.model"
msgstr "Clone all available objects of the specified Model"

msgid "opt.clone.target_co_id"
msgstr "Target CO ID"

msgid "opt.clone.target_server_id"
msgstr "Target Server ID"

msgid "opt.clone.uuid"
msgstr "Clone the object with the specified UUID"

msgid "opt.co_id"
msgstr "CO ID"

Expand Down
6 changes: 6 additions & 0 deletions app/resources/locales/en_US/error.po
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ msgstr "{0} already exists with this name"
msgid "exists.GroupMember"
msgstr "{0} is already a member of Group {1}"

msgid "exists.uuid"
msgstr "A record already exists with this UUID ({0} ID {1})"

msgid "data.Load"
msgstr "Failed to Load Data"

Expand Down Expand Up @@ -430,6 +433,9 @@ msgstr "Type {0} is in use and cannot be deleted"
msgid "Types.isdefault"
msgstr "Type {0} is in use as a default (via CO Settings)"

msgid "Types.unique"
msgstr "The requested value {0} is already in use by Type ID {1}"

msgid "unknown"
msgstr "Unknown value \"{0}\""

Expand Down
9 changes: 9 additions & 0 deletions app/resources/locales/en_US/field.po
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ msgstr "Country Code"
msgid "created"
msgstr "Created"

msgid "cri"
msgstr "Change Request Identifier"

msgid "datepicker.am"
msgstr "AM"

Expand Down Expand Up @@ -122,6 +125,9 @@ msgstr "Description"
msgid "display_name"
msgstr "Display Name"

msgid "do_not_clone"
msgstr "Do Not Clone"

msgid "edupersonaffiliation"
msgstr "eduPersonAffiliation"

Expand Down Expand Up @@ -342,6 +348,9 @@ msgstr "URL"
msgid "username"
msgstr "Username"

msgid "uuid"
msgstr "UUID"

msgid "valid_from"
msgstr "Valid From"

Expand Down
6 changes: 6 additions & 0 deletions app/resources/locales/en_US/information.po
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ msgstr "Current version: {0}"
msgid "ug.version.target"
msgstr "Target version: {0}"

msgid "ug.tasks.assignUuids"
msgstr "Assigning UUIDs (this may take a while for larger deployments)"

msgid "ug.tasks.assignUuids.count"
msgstr "{0} records for {1}..."

msgid "ug.tasks.buildGroupTree"
msgstr "Recovering Group tree"

Expand Down
5 changes: 4 additions & 1 deletion app/resources/locales/en_US/result.po
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ msgstr "Authenticator Unlocked"
msgid "Authenticators.unlocked-a"
msgstr "Authenticator {0} Unlocked"

msgid "clone.actor"
msgstr "Cloned from CO {0}"

msgid "copied"
msgstr "Copied"

Expand Down Expand Up @@ -266,7 +269,7 @@ msgid "search.none"
msgstr "No results found"

msgid "search.result.found"
msgstr "Found {0} results"
msgstr "{0,plural,=0{No matches found} =1{Found 1 match} other{Found # matches}}"

msgid "search.result.found.modelCount"
msgstr "{0} {1}"
Expand Down
Loading

0 comments on commit 8e0b5ab

Please sign in to comment.