Skip to content

Commit

Permalink
SacImports: WSO2 log uuid -> hitobito id mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-illi authored and amaierhofer committed Dec 11, 2024
1 parent 0e94620 commit d14b7df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/domain/sac_imports/csv_source/wso2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SacImports::CsvSource
# they must match the order of the columns in the CSV files
Wso2 = Data.define(
:um_id, # "UM_ID",
:_um_user_name, # "UM_USER_NAME",
:um_user_name, # "UM_USER_NAME",
:wso2_legacy_password_hash, # "UM_USER_PASSWORD",
:wso2_legacy_password_salt, # "UM_SALT_VALUE",
:_um_changed_time, # "UM_CHANGED_TIME",
Expand Down
2 changes: 1 addition & 1 deletion app/domain/sac_imports/wso2/person_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def assign_new_person_attributes
person.birthday = row.birthday
person.gender = gender
person.language = language
build_phone_number(person, :phone, "Hauptnummer")
build_phone_number(person, :phone, "Haupt-Telefon")
build_phone_number(person, :phone_business, "Arbeit")
end

Expand Down
13 changes: 13 additions & 0 deletions app/domain/sac_imports/wso2_people_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ class Wso2PeopleImporter
:errors
]

UM_USER_NAME_LOG_HEADERS = [
:hitobito_id,
:um_user_name,
:email
]

def initialize(output: $stdout)
PaperTrail.enabled = false # disable versioning for imports
@output = output
@source_file = CsvSource.new(:WSO21)
@csv_report = CsvReport.new(:"wso21-1_people", REPORT_HEADERS, output:)
@um_user_name_log = CsvReport.new(:"wso21-1_um_user_name_log",
UM_USER_NAME_LOG_HEADERS, output:)
@existing_emails = load_existing_emails
basic_login_group # warm up to ensure group is present before forking threads
abo_group # warm up to ensure group is present before forking threads
Expand Down Expand Up @@ -71,6 +79,11 @@ def process_row(row)
# @output.print(entry.valid? ? " ✅\n" : " ❌ #{entry.error_messages}\n")
if entry.valid?
entry.import!
@um_user_name_log.add_row(
hitobito_id: entry.person.id,
um_user_name: row.um_user_name,
email: row.email
)
if entry.warning
@csv_report.add_row({
navision_id: row.navision_id,
Expand Down

0 comments on commit d14b7df

Please sign in to comment.